I have noticed a critical issue that faces visually impaired people living in the Middle East region, the lack of visually impaired facilities such as tactile paving makes it impossible to them to live a normal life. At the begging I thought of attaching an ultrasonic sensor to a stick, however after a further research I decided to allocate the senor to the belt. My product consist of an ultrasonic sensor (SR-04) which measures distance, this sensor is connected to a AA tiny44, when an object is 1 meter to 3 meters close from the user a buzzer would create some kind of sound to alert the user, thus the user will immediately change his/her location in order to avoid the object.
I started by designing a simple prototype using card board to asses my design, below is an image of the first prototype. SR-04 sensor dimension: 452015 mm, the echo and trigger cylinder are 8mm radius.Thus, I have decided to create a box 505050 mm.
###### ADD image for first prototype
My cube was extremely huge which will make it impractical to have it on placed on your belt, thus I decided to remove the battery from the box and place it in the user pocket.
I decided to use free cad software to design my product, the images below clearly describe the method I used to design.
I have used the Ultimaker 3, where I have uploaded free cad exported as mesh stl file to Cura.
Constrains: 1. I set the object up-side-down which made the printer print on empty space.( ultimaker 3 did a good job doing that) 2. The opening cylindering were very tiny, thus had to increase the diameter 3. After designing the circuit board, the huge amount of wire were immpossible to fit in.
The first step was to carefully review all your input and output and device data sheets and working principles. My input device is the sr-04 sensor, where my output devices are a LED and a buzzer. I ll be using a 9 volts battery, thus a 5v regulator must be added the circuit
The sr-04 sensor consist of a trigger and echo, where the you only need to supply a short 10uS pulse to the trigger input to start the ranging, an d then the module will send out an 8 cycle burst of ultrasound at 40 kHz and raise its echo. The Echo is a distance object that is pulse width and the range i n proportion .You can calculate the range through the time interval between sending trigger signal and receiving echo signal. Formula: uS / 58 = centimeters or uS / 148 =inch; or: the range = high level time velocity (340M/S) / 2; we suggest to use over 60ms measurement cycle, in order to prevent trigger signal to the echo signal.''from the date sheet''.
In short a trigger would send a signal of 10-15 us, and the echo will be ready to recieve this signal, once this signal is received at the echo the time of this signal is used to get the distance in meters , you ll have to multiply the time of the echo signal by 340 m/s (speed of sound) divided by 2.
To design this circuit I will be using Kokopelli software. I used AA tiny 44 cad file designed by Neil and I modified it.
After soldering I encountered some issue as my programmer wasn't able to program the board ( Error massage: Check connection), the AA tiny 44 ground pin wasnt soldered properly to the board.
The regulator was releasing smoke as I forgot to add a diode to not block 5 volts from the programmer while programming the board.
The device and the code is working fine when connected the programmer, however when connected to the 9 volts battery the regulator fails to supply 5 volts and only supply the micro-controller with 3 volts.
Note: I have used register number 1 (16 bit register) TCNT1. Moreover, prescaler 1 has been used as the sr-04 maximuim distance is 4 meter which is 23,200 us = 0.0232 seconds. 16 bit (65536 value) divided by clock speed (1,000,000 hz) would equal to 0.065536 seconds till the counter overflows.
// 7th sense product
//
// HC-SR04 sonar sensor and buzzer code
//
// when the distance is above 200 cm and below 400 cm the buzzer will turn on to alert the user
//
// Murad Mousa Saadeh
// 18/12/2017
//
// This work may be reproduced, modified, distributed,
// performed, and displayed for any purpose. Copyright is
// retained and must be preserved. The work is provided
// as is; no warranty is provided, and users accept all
// liability.
#define F_CPU 1000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#define setbit(register,bit) (register |= (1 << bit))
#define clearbit(register,bit) (register &= ~(1 << bit))
#define testbit(register,bit) (register & (1 << bit))
int myTime=0;
int Distance=0;
ISR(PCINT0_vect){
if (testbit(PINA, PA0)){
TCNT1 = 0;
TCCR1B |= (0<<CS11);
TCCR1B |= (1<<CS10); // These 2 register will set the prescaler to 1 and start the counter
}
else
{
//stop counter and measure time
TCCR1B |= (0<<CS11);
TCCR1B |= (0<<CS10); // These 2 register will set the prescaler to 0 and stop the counter
myTime= TCNT1/1000000; // measure time in seconds
Distance= myTime*340/2; //distance in m
if (TCNT1 < 5000){
clearbit(PORTA, PA3);// LED on
}
else {
setbit(PORTA, PA3); // LED off
}
}
}
int main(void) {
setbit(DDRA,PA1);// set trig as output
clearbit(DDRA,PA0);// set echo input
setbit(DDRA,PA3); // set LED as output
setbit(PORTA,PA3);//set LED OFF
sei(); //activate global interrupt
GIMSK |= (1<<PCIE0); // interrupt in port A, could be done using mcros (GIMSK, PCIE0);
PCMSK0 |= (1<<PCINT0); // interrupt in pin 0, could be done using mcros (PCMSK0, PCINT0);
// main loop
//
while (1) {
//
// trigger pulse
//
clearbit(PORTA,PA1);
setbit(PORTA,PA1);
_delay_us(12);
clearbit(PORTA,PA1);
_delay_ms(1000); // increases time between measures
}
}