On 27 February 2015, a small group of EDGErs went to LEGOLAND for an EV3 Hackathon. This post documents one of the projects that came out of the event.
For the EV3 Hackathon, Magee and I built a low-tech intersection–one that controls traffic flow using boom gates rather than bluetooth signals. Since the cars were equipped with ultrasonic sensors, they were able to detect the lowered boom gates and stop.
Here is an overview of the program (click for a larger version):
The traffic light used the EV3 brick status lights to generate red, amber, and green lights. The boom gates were synchronized with the lights–when the light turned red, the boom gate for that road came down and the boom gate for the intersecting street went up. Here is the loop that controlled the traffic light and boom gates:
The intersection also featured a pedestrian crossing. When the WALK button (a touch sensor) was pressed, both boom gates were lowered and the traffic light turned red. The EV3 display switched from saying DON’T WALK to showing a cartoon walker. A recorded voice said, “Walk.” After five seconds, the display switched back to DON’T WALK and the normal traffic sequence started again. Here is the pedestrian-crossing section of the program:
To create the cartoon walker, I used the Image Editor in the MINDSTORMS software to draw a stick figure walking. I saved the image to a file. I then edited the original image, changing the position of the legs, and then saved the new image to another file. In the program, I put both images in a loop, displaying each image for half a second. I ran the loop five times, creating a walking figure on the EV3 display for five seconds.
Because the walk signal could be pressed at any time, the program needed to keep track of the position of the two boom gates at all times, so that it would know which gate needed to be lowered for the pedestrian crossing. To do this, I used a variable, A down, to record whether the A boom gate was up or down. Each time the A gate was raised or lowered, the variable was updated. When the walk button was pushed, I used a switch block to lower the correct gate depending upon the current value of A down.
So, what did I learn? First, working with the EDGE group is a lot of fun! Second, the boom-gate intersection worked reliably to control cars, but it was much less cool than the bluetooth intersection. The one advantage of the boom-gate intersection was that it was more people friendly. With the visible traffic light and the physical boom gates, a person at the intersection would have a better sense of which street currently had the right of way than with the bluetooth intersection. Also, the pedestrian crossing allowed people on foot to use the intersection, not just cars. In the future I would like to incorporate some of these people-friendly features into a bluetooth intersection.
EDGE Hackathon 2015
- Boom-gate intersection (EV3 Hackathon 2015)
- Building with RCX/NXT lamps and EV3 pieces
- Programming Bluetooth on EV3
Latest posts by Barbara Bratzel (see all)
- New Dr E’s MINDSTORMS and WeDo Challenges - 13 February 2018
- Does LEGO BOOST have a place in education? - 20 January 2018
- New cycle of Dr. E’s WeDo and MINDSTORMS challenges - 23 September 2017