iX
Introduction¶
iX is designed to help blind people cross the road. It includes 4 components: hub, range finder, traffic light and buzzer carried by user. The buzzer will get connected to the wifi when it is near to the surver. Whenever the range finder detect anyone trying to cross the road, the buzzer will play different sounds to inform user the state of the traffic light.
Network¶
Range detector¶
The range detector sends a flag to the hub if it detects anyone crossing the road.
We are using the MB1000 LV‑MaxSonar‑EZ0 ultrasonic rangefinder.
data sheet: http://www.maxbotix.com/documents/MB1000_Datasheet.pdf
pin numbers | MB1000 pins | mbed pins |
---|---|---|
1 | BW | not connected |
2 | PW | not connected |
3 | AN | p15 |
4 | RX | not connected |
5 | TX | not connected |
6 | VCC | 3.3V |
7 | GND | 0V |
- Ranging
Outputs analog voltage with a scaling factor of (Vcc/512) per inch. 3.3V yields 6.4mV/in. The output is buffered and corresponds to the most recent range data.
- Operating Range
The sensor minimum reported distance is 6-inches (15.2 cm). However, the LV-MaxSonar-EZ will range and report targets to the front sensor face. Large targets closer than 6-inches will typically range as 6-inches.
The sensor saturation distance is 254-inches (6.45 m).
Because of acoustic phase effects in the near field, objects between 6-inches and 20-inches may experience acoustic phase cancellation of the returning waveform resulting in inaccuracies of up to 2-inches. These effects become less prevalent as the target distance increases, and has not been observed past 20-inches (50.8 cm).
- Response
Our designed road width is 20cm. Whenever the range detector detects a target nearer than 20cm, it will send a flag back to the hub telling there is someone crossing the road.
obstruction.cpp
#include "mbed.h" AnalogIn ranger(p15); int obstruction_finder() { AnalogIn ranger(p15); //read analogue input from range detector float r; //define r float d; //define d int obstruction; //define obstruction r = ranger; //read ranger d = r / 0.00084; //calculate distance in cm if (d < 20) { obstruction = 1; //when d<20, there is obstruction } else { obstruction = 0; //when d>20, there is no obstruction } return obstruction; //return the value of obstruction }
Cross counter¶
The Cross counter counts the no. of crosses happen when the red light is on, and display the counting on the TextLCD.
We are using a HD44780 TextLCD.
data sheet: https://www.sparkfun.com/datasheets/LCD/HD44780.pdf
Pin number | TextLCD pins mbed pins | |
1 | GND | 0V |
2 | VCC | 3.3V |
3 | VO | 0V, via 1k resistor |
4 | RS | p15 |
5 | RW | 0V |
6 | E | p16 |
7 | D0 | not connected |
8 | D1 | not connected |
9 | D2 | not connected |
10 | D3 | not connected |
11 | D4 | p17 |
12 | D5 | p18 |
13 | D6 | p19 |
14 | D7 | p20 |
The counter will receive a flag from the hub whenever there is someone crossing the road during a red light. We do a for loop, so the counter will keep checking the input flag and increment by one when the flag is high.
Buzzer and traffic light¶
The traffic light repeats the same pattern: green-quick yellow-red-yellow-green. We devide them into 3 situations and send the corresponding flag to the surver. The buzzer receives both flags sent by range detector and traffic light. The buzzer is triggered when the range finder detects a cross. The reactions of Buzzer is according to 3 statements of traffic light.
- VOICE 3
buzzer_green.cpp
#include "mbed.h" PwmOut buzzer(p23); //green light while (flag = 3); { int main() { buzzer.period_ms(1); //1ms period 1k Hz // buzzer = 0; //0% duty cycle // }
- VOICE 1
buzzer_red.cpp
#include "mbed.h" PwmOut buzzer(p23); // red light float frequency[]= {500,0,500,0,500,0,500,0,500,0} ;//alarm frequency array float beat[]= {1,1,1,1,1,1,1,1,1,1}; //beat array int main() { for ( int i=0; i<=9 ; i++) {buzzer.period(1/(frequency[i])); // PMW period 1/frequency buzzer=0.5; //50% duty cycle wait(0.5*beat[i]); //hold for beat period } }
This voice is for the red light and quick yellow light (from green to red).
- VOICE 2
buzzer_yellow.cpp
#include "mbed.h" PwmOut buzzer(p23); // yellow light while (flag = 2); { float frequency[]= {659,554,659,554,550,494,554,587,494,659,554,440}; //music frequency array float beat[]= {1,1,1,1,1,0.5,0.5,1,1,1,1,2}; //beat array int main() { for ( int i=0; i<=11; i++) {buzzer.period(1/(frequency[i])); // PMW period 1/frequency buzzer=0.5; //50% duty cycle wait(0.5*beat[i]); //hold for beat period } } }