You are on page 1of 11

Final deliverable

Smart Products
Telmo Garai López
Mikel Corres Eroa
May 2021
Project description and motivation. Target
market:

Description
Our project consists of a security system for bicycles or any kind of non road
vehicle such as scooters, etc… It is capable of warning about danger in your blind
spots and in case of an accident, contacts a rescue team.

How it works?
The system makes sure that the cyclist has at least one of his or her two hands on
the handlebar.
Then, it also provides information about how far an object behind the bicycle is,
so that the cyclist increases the focus on the road and is aware and conscious
about it and makes the right decision in order to avoid any incident.
If the worst possible case happens, and the cyclist has an accident, probably the
cyclist will fall off the bike and the hands won’t be on the handlebar any more. If
this happens, thirty seconds after the system has detected that, it will send an
alarm to a relative of the victim or the nearest hospital.

Target market:
Our target market consists of people who are forced to share the road while
biking. Cyclists who do lots of kilometers on the side of the main roads or just
people biking around the city to go shopping or to work.
Sadly it is quite common to hear on the news that a cyclist has been hit by a car
nowadays, but this is normal. Nowadays there are more cars than ever on the
roads, and the popularity of bicycles has increased a lot.
Obviously this product will also be helpful for other types of users, but we have
concluded that these are our main focus.

Main functions of the proposed system:


As we have stated, there will be three main functions:
- Doble touch sensor: To detect if the hands are positioned on the handlebar
or not. This sensor is key to be functioning perfectly, being the one that is
responsible for detecting the danger.

- Grove ultrasonic ranger sensor: This sensor is going to measure the


distance to an object behind the bicycle.
- LED strip: Provides the cyclist the data collected by the ultrasonic sensor in
an intuitive way. Will make the cyclist be aware of the situation.

- Speech recognizer sensor: In the case that once the incident or accident
has happened, and the biker can’t reach the bike in less than 30 seconds,
the speech recognizer will stop the alarm notification if the right command
is received.

Updated project plan

1 & 2. Tasks, distribution and time :

Product Idea Sensor Communicati Final Documentati Program


and integratio ons Integrate on development
conceptualiza n, testing integration, d testing
tion testing

Mikel

Telmo

Time 3 hours 4 hours 1 hours 1 hours 2 hours 8 hours


Investe
d
(each)

3. Estimated initial and final date for each task :

Monday Tuesday Wednesda Thursday Friday Saturday Sunday


y
Monday Tuesday Wednesda Thursday 7. 8. 9.
y Product Product Product
Idea and Idea and Idea and
conceptua conceptua conceptua
lization lization lization

10 11. 12. 13. 14. 15. 16.


Sensor Communi Program Program
integration cations developm developm
, testing. integration ent ent
, testing

17 18. 19. 20. 21. 22. 23.


.Communica Sensor Program Program Program Program Program
tions integration, developme developm developm developm developm
integration, testing. nt ent ent ent ent
testing

24. 25.
Documentat Document
ion and ation,
program Program
developme developme
nt nt and final
integrated
testing

Strategy followed
1. First we made the touch sensors work as we wanted to. Their work could
be defined with the following table
1 1 = 0
1 0 = 0
0 1 = 0
0 0 = 1

2. Then we implemented the wifi connection to our device. At first it was


quite tricky but we managed to make it work earlier than we thought. The
connexion with ThingSpeak works well, giving a SOS signal when needed,
this could redirect into another security page or phone call inorder to warn
an Ambulance about the incident.

3. Then we tried with the speech recognizer, after downloading the libraries
we needed, ESP Sparkfun module started giving compilation problems, so
we had to leave this option and use a button instead which works as the
speech recognizer would.

4. The ultrasonic sensor and the led strp were mutually connected so we left
them for the final part as we had already used them earlier. We had some
problems with this part due to the sensors and Led stripe not working
properly, and having some programming issues, but after all we managed
to make them work as we wanted to.

5. Finally, we mixed both programs in one, and implemented the Led stripe
functions in some of the code from the touch sensors as we mentioned in
the explanation of the system. Overall we are pleased with the result even
though some of the sensors are quite sensitive and not so accurate so the
model would be in an early phase.

Photographs of the prototype:

Interior:
Mounted:
Arduino code just in case:

#include <Arduino.h>
#include <WiFi.h>
#include "ThingSpeak.h"
#include <HTTPClient.h>
#include "Ultrasonic.h"
#include <Adafruit_NeoPixel.h>

//WiFi
const char* ssid = "MIWIFI_KAez_plus";
const char* password = "y9SYTzjq";
WiFiClient client;

//LED & Ultrasonic


const int pinLed = 2;
#define NUMPIXELS 9
Ultrasonic ultrasonic(27);
Adafruit_NeoPixel pixels(NUMPIXELS, pinLed, NEO_GRB + NEO_KHZ800);

//SENSORS
const int SENSOR_PIN = 37; // the Arduino's input pin that connects to the
sensor's SIGNAL pin
const int SENSOR_PIN2 = 35;
const int BOTON = 18;

// Variables will change:


int currentState1;
int currentState2;
int boton;
int lastboton=0;
int lastState;
int lastState2;
int sos=0;
unsigned long myTime;
unsigned long lastTime;

//wifi
unsigned long myChannelNumber = 1398352;
const char * myWriteAPIKey = "PZDQEHW1211PU2ZI";

void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
//Initialize Wifi communication
Serial.println(ssid);
WiFi.begin (ssid, password),
ThingSpeak.begin(client);
// initialize the Arduino's pin as an input
pinMode(SENSOR_PIN, INPUT);
pinMode(SENSOR_PIN2, INPUT);
pinMode(BOTON, INPUT);
// initialize pixels
pixels.begin();
}

void loop() {

// LED functioning
pixels.clear();
long RangeInCentimeters;
long warningZone = 100;
long warningZone2 = 50;
long warningZone3 = 20;

Serial.println("The distance to obstacles in front is: ");


RangeInCentimeters = ultrasonic.MeasureInCentimeters(); // two measurements
should keep an interval
Serial.print(RangeInCentimeters);//0~400cm
Serial.println(" cm");

for(int i=0; i < 9; i++){


pixels.setPixelColor(i,pixels.Color(0,0,0));
pixels.show();
}
if (RangeInCentimeters < warningZone){
for(int i=0; i < 3; i++){
pixels.setPixelColor(i, pixels.Color(0, 255, 0));
pixels.show();
}
}
if (RangeInCentimeters < warningZone2){
for(int i= 3; i < 6; i++){
pixels.setPixelColor(i, pixels.Color(255, 255, 0));
pixels.show();
}
}

if (RangeInCentimeters < warningZone3){


for(int i= 6; i < 9; i++){
pixels.setPixelColor(i, pixels.Color(255, 0, 0));
pixels.show();
}
}

//SENSOR FUNCTIONING
// read the state of the the input pin:
currentState1 = digitalRead(SENSOR_PIN);
currentState2 = digitalRead(SENSOR_PIN2);
boton = digitalRead(BOTON);

if((lastState == LOW && currentState1 == HIGH) || (lastState2 == LOW &&


currentState2 == HIGH)){
Serial.println("Everything is okey");
sos = 0;
ThingSpeak.setField(1,sos);
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
}
if((lastState == HIGH && currentState1 == LOW) && ( currentState2 == LOW)){
Serial.println("User has fallen");
lastTime = millis();
}
if((lastState2 == HIGH && currentState2 == LOW) && ( currentState1 == LOW)){
Serial.println("User has fallen");
lastTime = millis();
}

lastTime = millis();

while (lastState == LOW && currentState1 == LOW && lastState2 == LOW &&
currentState2 == LOW && boton == LOW){
if ( millis()-lastTime > 30000){
callAmbulance();
}
currentState1 = digitalRead(SENSOR_PIN);
currentState2 = digitalRead(SENSOR_PIN2);
boton = digitalRead(BOTON);
}

if(lastboton == LOW && boton == HIGH){


Serial.println("Ambulance call cancelled");
}

lastState = currentState1;
lastState2 = currentState2;
delay(1000);
}

void callAmbulance(){
Serial.println("Calling ambulance");
sos = 1;
for(int i=0; i < 9; i++){
pixels.setPixelColor(i,pixels.Color(255,0,0));// Turn everything red
pixels.show();
}
ThingSpeak.setField(1,sos);
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
}

You might also like