Crossing the streets in Cairo is quite adventurous. For this week's circuit I like to dream of Cairo pedestrian crossroads having sensors to register when a pedestrian is walking towards a crossroad, which activated the red light to make the cars stop.
In real life in busy Cairo the cars would never be able to drive again of course. But pedestrian detection systems are a nice solution for calm neighborhoods.
Software
Tinkercad for testing the circuits and writing the code blocks.
Arduino software to adjust and test the code and upload the code to the Arduino Uno board
Materials
For the circuit in Tinkercad, I used the Arduino Uno, the ultrasonic distance sensor, a red led and a 220 Ohm resistor
Circuit on Tinkercad
In Tinkercad I connected the 5Volt pin of the Arduino to the breadboard. I connected GND of Arduino the the ground of the breadboard.
The Ultrasonic sensor is connected to the ground and positive side of the board. The 2 other pins are connected to Arduino. Trigger to pin 9 and echo to pin 6.
I added a resistor to the led.
Code blocks on Tinkercad
In codeblocks I added the IF - THEN - ELSE condition. So when the sensor reads a presence within half a meter on trigger pin 9 (the pedestrian almost arrived to the stoplight), then pin 2 is switched to high, turning the red light on.
Then there is a 10 seconds wait to give the pedestrian a chance to run. After that the red light turns off.
If there is no trigger on the sensor, the red light stays turned off.
The text code, to upload to the physical Arduino
Physical circuit
I connected the breadboard to Arduino, positive to 5V and negative to GND.
The lamp has a resistor from the catode to the negative row. The Anode is connected to pin 2 of the Arduino.
The Ultrasonic distance sensor has 4 pins. VCC is connected to the power row, ground is connected to the negative row, Trigger is connected to pin 6 and Echo is connected to pin 9.
I uploaded the code to Arduino and tested the distances.
Video testing the circuit. The peg doll represents a pedestrian on the way to cross the street. The riding duck represents a car.
When the pedestrian comes closer to the ultrasonic sensor, the led turns red.
I tried different distances and waiting times. Since my pedestrian and car were sized down, I made the distance and waiting time less.
After watching the midweek practice videos, I tried recreating the circuits and all went well.
I wanted to make some adjustments in the coding to make the motor pause for a longer time and run slower.
I was not able to successfully make the motor pause for the time I wanted to. So I posted my issue on Slack, community trouble shooting. One of our instructors replied with some suggested changes. I changed the settings but it still didn't work. So I suggested to speak about in in our midweek session.
In the end the changes I wanted to make will be covered in the next weeks. So I decided to move this project to later in the program and I made a new assignment with a single input and output.
Part of the circuit didn't work because the required volt wasn't reached. I asked on Slack community trouble shooting for help.
This issue will be covered in the next weeks, but I really wanted to try to make my circuit work for now. So I watched some youtube videos. I understood that I have to add a second power source to power the motor and lamp, but I don't understand how to connect them to the higher power source AND connect them to arduino.
So all parts worked, but the arduino couldn't reach the motor or lamp.
Malfunctioning circuit
After making the physical circuit, the led stayed on permanently.
In the extra session on Sunday I asked for help from instructor Ahmed Samy. We tried changing the parameters from 50 cm to 20 cm and make the waiting intervals less. Then we tried changing the echo and trigger pin.
The circuit worked after changing the trigger and echo pin. The first time I accidentally changed the echo and trigger pin both on the circuit as in the code.
Helpful videos on youtube: Servo with external power supply - Arduino Tutorial 27#
Inspiration video for the moving illustrations in the form of a conveyer belt.
For my final project I will need to make a roll of illustrations move at a certain pace. The movement will have to stop for x amount of time for each stretch pose and start again.
With each illustration there will be a sound played at the end as well to notify the people to move to the next position. At the end of the whole exercise the roll will have to reverse back to the original position.
With what we learned this week, I am able to program Arduino to receive a single output and send a signal to an output. Since my final project will have multiple in and outputs, I will build the coming weeks on this knowledge to make my project smarter.
The skills and knowledge of this week will help me make my final project smarter.
The end of week practice videos were fun to recreate. I especially was surprised how easy it was to make a simple circuit including a sensor. I used to be intimidated by sensors as I didn't understand how to operate them.
I drew a new design/prototype in Fusion360. In the past I used to only draw in 2D in Autocad. Being able to extrude and assemble + check for interferences is really nice.
The drawing was not fully defined though as I struggled to find a way to define all the arches.
Hopefully I can go do the CNC this week to see the product in real life and test it.
Guitar stand in Fusion
I enjoyed the extra session on Saturday a lot. We learned how to make a paper circuit and we used the soldering machine to make a simple circuit on a PCB. The session was a nice mix between being informative and hands on.