Soldering all the component

Soldering , is a process in which two or more items (usually metal) are joined together by melting and putting a filler into the joint, the filler metal having a lower melting point than the adjoining metal.

After we finish all the function, we want to soldering all the component together.

BA2FB7F8CB8D98A760F9312D09A49C93

7EF8E0B1558A21CD060238489406784B


Logo design

A logo is the most important visual symbol of a business, and it provides symbolic representation of the values of the company and its products. A quality logo is attractive, attention-getting and memorable. An effective one offers a subconscious reminder to consumers of the brand image of a company or a product.

Our group member design several logo by hand drawing

2841990DFE0F46B1EEC30186B22DEDDF

Then I use AI draw the logo

Through discussing we finally choose the following logo

logo

Wireless connections

Bluetooth is a wireless technology standard for exchanging data over short distances. So we choose the bluetooth to connect our arduino with our computer.

We used one 8*8 LED Matrix screen, which spends more power. Everytime I wanted to upload the code, it would notice that plugging in too much power. Thus, I had to remove it from this circuit.

Fix the proble of falling down fuction:

We want the smart can can detect the falling of senoir, the the light will on. when the senors do not close the light by pressing the button  in several minites the smart cane will send message for help. However, the light can not controlled by the button. After research we found the reason.

if ((lineacc.z()>=3)&&(buttonState==HIGH))
{
digitalWrite(ledPin2, HIGH);
Serial.println(“I NEED HELP”);
delay(10000);

}
else
{
digitalWrite(ledPin2, LOW); // turn the LED off
}

Reason:  the code can not jump out untill the delay function finished.

Luckily,  with the help of  David Zhao. Finally, his friend who is good at arduino code helped us rewrote this part of code.

Final Arduino Code on Fall Detection:

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>

#define BNO055_SAMPLERATE_DELAY_MS (100)
const int ledPin2 = 13; // LED pin
int pushButton = 5;
int setTime=0;
long time1,time2;

Adafruit_BNO055 bno = Adafruit_BNO055(55);

void displaySensorDetails(void)
{
sensor_t sensor;
bno.getSensor(&sensor);
Serial.println(“————————————“);
Serial.print (“Sensor: “); Serial.println(sensor.name);
Serial.print (“Driver Ver: “); Serial.println(sensor.version);
Serial.print (“Unique ID: “); Serial.println(sensor.sensor_id);
Serial.print (“Max Value: “); Serial.print(sensor.max_value); Serial.println(” xxx”);
Serial.print (“Min Value: “); Serial.print(sensor.min_value); Serial.println(” xxx”);
Serial.print (“Resolution: “); Serial.print(sensor.resolution); Serial.println(” xxx”);
Serial.println(“————————————“);
Serial.println(“”);
delay(1000);
}
void setup(void)
{
pinMode(pushButton, INPUT);

Serial.begin(9600);
Serial.println(“Orientation Sensor Test”); Serial.println(“”);
pinMode(ledPin2, OUTPUT);

/* Initialise the sensor */
if(!bno.begin())
{
/* There was a problem detecting the BNO055 … check your connections */
Serial.print(“Ooops, no BNO055 detected … Check your wiring or I2C ADDR!”);
while(1);
}

delay(1000);

/* Display some basic information on this sensor */
displaySensorDetails();
}
void loop(void)
{
int buttonState = digitalRead(pushButton);

/* Get a new sensor event */
sensors_event_t event;
bno.getEvent(&event);
imu::Vector<3> lineacc = bno.getVector(Adafruit_BNO055::VECTOR_LINEARACCEL);

time2=millis();
if ((lineacc.z()>=3)&&(buttonState==HIGH))
{
digitalWrite(ledPin2, HIGH);
if (setTime==0){
time1 = millis();
setTime=1;
}
if ((time2-time1)>5000){Serial.println(“fell down”);}
//else{Serial.println(” “);}
} // turn the LED on
if(buttonState==LOW)
{
digitalWrite(ledPin2, LOW);
setTime=0;

We use time function to decide situation. when user press the button, the system will begin to record time. Finally we can use button control the led on and off  then the smart can can decide send message for help or not.

WechatIMG8


Sendind message

On the previouse processing code, we used “String val” to receive the data. However, when all the code are existing on the same file, it would constantly send data in different names. When processing receives the data, we named all the sensor, such as val 1, val 2, which could lead to spent more time on receiving data.

Luckily, we found a tutorial about how to transform information betweew Arduino and processing the following is the example

//Processing Code
import processing.serial.*;

Serial myPort;

void setup(){
myPort = new Serial(this,”/dev/ttyACM0″, 115200); //in fact, any rate is ok…
myPort.bufferUntil(‘\n’); //buffer until meet ‘\n’, then call the event listener
}

void draw(){

}

//listen to the event. when buffer filled, run this method
void serialEvent(Serial p) {
String inString = p.readString();
print(inString);
}

//then the buffer will reveive all the bytes
//Arduino Code
int data=12345;
void setup()
{
Serial.begin(115200);//rate
}
void loop()
{
Serial.println(data); //send data, end up with ‘\n’
delay(1000);
}

Then we have changed our coding


Final Processing Code:

//Processing Code
import processing.serial.*;
String data;
Serial myPort;
PImage bg;
PImage img;

void setup(){///dev/cu.HC-06-DevB, /dev/cu.usbserial-DN01DVI6
myPort = new Serial(this,”/dev/cu.HC-06-DevB”, 9600); //Set Serial Port
myPort.bufferUntil(‘\n’);
size(395,768);
bg = loadImage(“smartcane.jpg”);
img = loadImage(“2.jpg”);
}

void draw(){
if(myPort.available()>0){
background(bg);
image(img, width/6, height/3);
String data = myPort.readString();
println(data);
//background(255);

text(” ” + data,80,325);
textSize(20);
fill(0);
delay(3000);
}
}

Final Arduino Code:

int pushButton3 = 3;
#define bushButton3
//for help

//acceleration
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>

#define BNO055_SAMPLERATE_DELAY_MS (100)
const int ledPin2 = 13; // LED pin
int pushButton2 = 5;
int setTime=0;
long time1,time2;
String data;

Adafruit_BNO055 bno = Adafruit_BNO055(55);
int readValue; // Use this variable to read Potentiometer
int writeValue; // Use this variable for writing to LED
//LED

void displaySensorDetails(void)
{
sensor_t sensor;
bno.getSensor(&sensor);

}
//acceleration

 

void setup() {
/*
The MAX72XX is in power-saving mode on startup,
we have to do a wakeup call
*/ Serial.begin(9600);

pinMode(pushButton3, INPUT);
//pinMode(buttonPin1, INPUT);
pinMode(pushButton2, INPUT);

Serial.begin(9600);
Serial.println(“Orientation Sensor Test”); //Serial.println(“”);
pinMode(ledPin2, OUTPUT);

/* Initialise the sensor */
if(!bno.begin())
{
/* There was a problem detecting the BNO055 … check your connections */
Serial.print(“Ooops, no BNO055 detected … Check your wiring or I2C ADDR!”);
while(1);
}

delay(1000);

/* Display some basic information on this sensor */
displaySensorDetails();
//acceleration
}

 

void loop(){
// temp
int sensorValue1 = analogRead(A3);
int sensorValue = analogRead(A1);
if((sensorValue1>=80)&&(sensorValue<=170))
{
//Serial.println(sensorValue1);
//Serial.println(sensorValue);
//Serial.println(“sweating”);
data=”sweating “;
delay(4000);
}
// temp

//button for help
// read the input pin:
int buttonState3 = digitalRead(pushButton3);

if(buttonState3==LOW)
{
data=”I need HELP. “;
delay(6000);
//Serial.println(“I fell down. I need HELP “);
}

//delay(500); // delay in between reads for stability
//button for help

//acceleration

int buttonState2 = digitalRead(pushButton2);

/* Get a new sensor event */
sensors_event_t event;
bno.getEvent(&event);

imu::Vector<3> lineacc = bno.getVector(Adafruit_BNO055::VECTOR_LINEARACCEL);

time2=millis();
if ((lineacc.z()>=0.5)&&(buttonState2==HIGH))
{
digitalWrite(ledPin2, HIGH);
if (setTime==0){
time1 = millis();
setTime=1;
}
if ((time2-time1)>5000){Serial.println(“fell down !”);}
//else{Serial.println(” “);}
} // turn the LED on
if(buttonState2==LOW)
{
digitalWrite(ledPin2, LOW);
setTime=0;
}else
Serial.print(data); //send data
delay(1000);
}

Final prototype

屏幕快照 2017-06-21 下午10.06.46

Reference

https://guoyunhe.me/zh/p/565

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s