Hello,
I’m am trying to make a smart glove for deaf and dumb using arduino uno, mpu6050 accelerometer, 4 flex sensors and a bluetooth module. I’m new at programming and have copied code from a YouTube channel, And the problem is that now the uploading is done and the bluetooth’s led light is blinking but there’s is no output. Can anyone help me as soon as possible! Thanks.
This is the code:
#include <MPU6050.h>
#define adc1 A0
#define adc2 A1
#define adc3 A2
#define adc4 A3
#define ledd 13
int flex2 = 0, flex1 = 0, flex3 = 0, flex4 = 0;
MPU6050 mpu;
void setup()
{
pinMode(ledd, OUTPUT);
digitalWrite(ledd, LOW);
Serial.begin(9600 );
Serial.println("Initialize MPU6050");
while (mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
{
Serial.println("Could not find a valid MPU6050 sensor, check wiring!");
delay(500);
}
checkSettings();
}
void checkSettings()
{
Serial.println();
Serial.print(" * Sleep Mode: ");
Serial.println(mpu.getSleepEnabled() ? "Enabled" : "Disabled");
Serial.print(" * Clock Source: ");
switch (mpu.getClockSource())
{
case MPU6050_CLOCK_KEEP_RESET: Serial.println("Stops the clock and keeps the timing generator in reset"); break;
case MPU6050_CLOCK_EXTERNAL_19MHZ: Serial.println("PLL with external 19.2MHz reference"); break;
case MPU6050_CLOCK_EXTERNAL_32KHZ: Serial.println("PLL with external 32.768kHz reference"); break;
case MPU6050_CLOCK_PLL_ZGYRO: Serial.println("PLL with Z axis gyroscope reference"); break;
case MPU6050_CLOCK_PLL_YGYRO: Serial.println("PLL with Y axis gyroscope reference"); break;
case MPU6050_CLOCK_PLL_XGYRO: Serial.println("PLL with X axis gyroscope reference"); break;
case MPU6050_CLOCK_INTERNAL_8MHZ: Serial.println("Internal 8MHz oscillator"); break;
}
Serial.print(" * Accelerometer offsets: ");
Serial.print(mpu.getAccelOffsetX());
Serial.print(" / ");
Serial.print(mpu.getAccelOffsetY());
Serial.print(" / ");
Serial.println(mpu.getAccelOffsetZ());
Serial.println();
}
void loop()
{
flex1 = analogRead(adc1);
flex2 = analogRead(adc2);
flex3 = analogRead(adc3);
flex4 = analogRead(adc4);
delay(10);
Vector rawAccel = mpu.readRawAccel();
Vector normAccel = mpu.readNormalizeAccel();
Serial.print(" Xnorm = ");
Serial.print(normAccel.XAxis);
Serial.print(" Ynorm = ");
Serial.print(normAccel.YAxis);
Serial.print(" Znorm = ");
Serial.println(normAccel.ZAxis);
Serial.print(flex1);
Serial.print("-");
Serial.print(flex2);
Serial.print("-");
Serial.print(flex3);
Serial.print("-");
Serial.print(flex4);
delay(100);
Serial.println(" ");
//////////////////////// 1////////////////////////////////
if ((flex1 > 1012) && (flex2 > 1000) && (flex4 > 1000) && (normAccel.YAxis > 3))
{
{
Serial.println("Need Medicine Immediately");
}
}
else if ((flex1 > 1011) && (flex2 < 990) && (flex4 > 1000) && (normAccel.XAxis > 3))
{
{
Serial.println("I Am Hungry");
}
}
else if ((flex1 < 1011) && (flex4 < 990) && (normAccel.XAxis > 3))
{
{
Serial.println("I Can Do It");
}
}
else if ((flex1 > 1011) && (flex2 < 990) && (flex4 < 990) && (normAccel.XAxis < 2) && (normAccel.YAxis < 2))
{
{
Serial.println("I Need To Use Washroom");
}
}
else if ((flex1 > 1011) && (flex2 < 990) && (flex4 > 1011) && (normAccel.XAxis < 2) && (normAccel.YAxis < 2))
{
{
Serial.println("Fine");
}
}
else if ((flex1 < 1011) && (flex2 < 990) && (flex4 > 1011) && (normAccel.XAxis > 3))
{
{
Serial.println("Need Help Emergency");
}
}
else if ((flex1 > 1011) && (flex2 > 1000) && (flex4 < 990) && (normAccel.YAxis > 4))
{
{
Serial.println("Hello");
}
}
else if ((flex1 > 1011) && (flex2 < 990) && (flex4 > 1011) && (normAccel.YAxis > 4))
{
{
Serial.println("K Bye.");
}
}
else if ((flex1 < 1012) && (flex2 > 1011) && (flex4 > 1011) && (normAccel.YAxis < 2))
{
{
Serial.println("Need Water");
}
}
digitalWrite(ledd,LOW);
if(normAccel.XAxis>3){Serial.println("listen up");}
else if(normAccel.XAxis<-3){Serial.println("hello");}
else if(normAccel.YAxis>3){Serial.println("i can do it");}
else if(normAccel.YAxis<-3){Serial.println("i am determind");}
else
{
digitalWrite(ledd,HIGH);
if(normAccel.XAxis>3){Serial.println("how are you");}
else if(normAccel.XAxis<-3){Serial.println("FAN");}
else if(normAccel.YAxis>3){Serial.println("need help");}
else if(normAccel.YAxis<-3){Serial.println("breathing problem");}
}
delay(1800);
}
I did File>Preferences >Show verbose output during: >upload >ok and am getting this:
System wide configuration file is "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf"
Using Port : COM6
Using Programmer : arduino
Overriding Baud Rate : 115200
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : Arduino
Description : Arduino
Hardware Version: 3
Firmware Version: 4.4
Vtarget : 0.3 V
Varef : 0.3 V
Oscillator : 28.800 kHz
SCK period : 3.3 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "C:\Users\HP\AppData\Local\Temp\arduino_build_729434/smartgloves.ino.hex"
avrdude: writing flash (8964 bytes):
Writing | ################################################## | 100% 1.48s
avrdude: 8964 bytes of flash written
avrdude: verifying flash memory against C:\Users\HP\AppData\Local\Temp\arduino_build_729434/smartgloves.ino.hex:
avrdude: load data flash data from input file C:\Users\HP\AppData\Local\Temp\arduino_build_729434/smartgloves.ino.hex:
avrdude: input file C:\Users\HP\AppData\Local\Temp\arduino_build_729434/smartgloves.ino.hex contains 8964 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 1.20s
avrdude: verifying ...
avrdude: 8964 bytes of flash verified
avrdude done. Thank you.
Please post the code in line, using code tags, along with a clear, hand drawn wiring diagram.
There is no reason for you, or for us, to hurry.
Take a look at the first topics having advice how to use this Form, how to attache info like code.
I woun't fill my phone by downloading files.
Try again
OPs code:
#include <MPU6050.h>
#define adc1 A0
#define adc2 A1
#define adc3 A2
#define adc4 A3
#define ledd 13
int flex2 = 0, flex1 = 0, flex3 = 0, flex4 = 0;
MPU6050 mpu;
void setup()
{
pinMode(ledd, OUTPUT);
digitalWrite(ledd, LOW);
Serial.begin(9600 );
Serial.println("Initialize MPU6050");
while (mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
{
Serial.println("Could not find a valid MPU6050 sensor, check wiring!");
delay(500);
}
checkSettings();
}
void checkSettings()
{
Serial.println();
Serial.print(" * Sleep Mode: ");
Serial.println(mpu.getSleepEnabled() ? "Enabled" : "Disabled");
Serial.print(" * Clock Source: ");
switch (mpu.getClockSource())
{
case MPU6050_CLOCK_KEEP_RESET: Serial.println("Stops the clock and keeps the timing generator in reset"); break;
case MPU6050_CLOCK_EXTERNAL_19MHZ: Serial.println("PLL with external 19.2MHz reference"); break;
case MPU6050_CLOCK_EXTERNAL_32KHZ: Serial.println("PLL with external 32.768kHz reference"); break;
case MPU6050_CLOCK_PLL_ZGYRO: Serial.println("PLL with Z axis gyroscope reference"); break;
case MPU6050_CLOCK_PLL_YGYRO: Serial.println("PLL with Y axis gyroscope reference"); break;
case MPU6050_CLOCK_PLL_XGYRO: Serial.println("PLL with X axis gyroscope reference"); break;
case MPU6050_CLOCK_INTERNAL_8MHZ: Serial.println("Internal 8MHz oscillator"); break;
}
Serial.print(" * Accelerometer offsets: ");
Serial.print(mpu.getAccelOffsetX());
Serial.print(" / ");
Serial.print(mpu.getAccelOffsetY());
Serial.print(" / ");
Serial.println(mpu.getAccelOffsetZ());
Serial.println();
}
void loop()
{
flex1 = analogRead(adc1);
flex2 = analogRead(adc2);
flex3 = analogRead(adc3);
flex4 = analogRead(adc4);
delay(10);
Vector rawAccel = mpu.readRawAccel();
Vector normAccel = mpu.readNormalizeAccel();
Serial.print(" Xnorm = ");
Serial.print(normAccel.XAxis);
Serial.print(" Ynorm = ");
Serial.print(normAccel.YAxis);
Serial.print(" Znorm = ");
Serial.println(normAccel.ZAxis);
Serial.print(flex1);
Serial.print("-");
Serial.print(flex2);
Serial.print("-");
Serial.print(flex3);
Serial.print("-");
Serial.print(flex4);
delay(100);
Serial.println(" ");
//////////////////////// 1////////////////////////////////
if ((flex1 > 1012) && (flex2 > 1000) && (flex4 > 1000) && (normAccel.YAxis > 3))
{
{
Serial.println("Need Medicine Immediately");
}
}
else if ((flex1 > 1011) && (flex2 < 990) && (flex4 > 1000) && (normAccel.XAxis > 3))
{
{
Serial.println("I Am Hungry");
}
}
else if ((flex1 < 1011) && (flex4 < 990) && (normAccel.XAxis > 3))
{
{
Serial.println("I Can Do It");
}
}
else if ((flex1 > 1011) && (flex2 < 990) && (flex4 < 990) && (normAccel.XAxis < 2) && (normAccel.YAxis < 2))
{
{
Serial.println("I Need To Use Washroom");
}
}
else if ((flex1 > 1011) && (flex2 < 990) && (flex4 > 1011) && (normAccel.XAxis < 2) && (normAccel.YAxis < 2))
{
{
Serial.println("Fine");
}
}
else if ((flex1 < 1011) && (flex2 < 990) && (flex4 > 1011) && (normAccel.XAxis > 3))
{
{
Serial.println("Need Help Emergency");
}
}
else if ((flex1 > 1011) && (flex2 > 1000) && (flex4 < 990) && (normAccel.YAxis > 4))
{
{
Serial.println("Hello");
}
}
else if ((flex1 > 1011) && (flex2 < 990) && (flex4 > 1011) && (normAccel.YAxis > 4))
{
{
Serial.println("K Bye.");
}
}
else if ((flex1 < 1012) && (flex2 > 1011) && (flex4 > 1011) && (normAccel.YAxis < 2))
{
{
Serial.println("Need Water");
}
}
digitalWrite(ledd,LOW);
if(normAccel.XAxis>3){Serial.println("listen up");}
else if(normAccel.XAxis<-3){Serial.println("hello");}
else if(normAccel.YAxis>3){Serial.println("i can do it");}
else if(normAccel.YAxis<-3){Serial.println("i am determind");}
else
{
digitalWrite(ledd,HIGH);
if(normAccel.XAxis>3){Serial.println("how are you");}
else if(normAccel.XAxis<-3){Serial.println("FAN");}
else if(normAccel.YAxis>3){Serial.println("need help");}
else if(normAccel.YAxis<-3){Serial.println("breathing problem");}
}
delay(1800);
}
After uploading, do you see the message “Initialize MPU6050” in the serial monitor?
Do you see the message “Could not find a valid MPU6050 sensor, check wiring!” repeating every 500mS?
Or any other serial messages in the serial monitor?
Railroader:
Take a look at the first topics having advice how to use this Form, how to attache info like code.
I woun’t fill my phone by downloading files.
Try again
Blackfin:
OPs code:
#include <MPU6050.h>
#define adc1 A0
#define adc2 A1
#define adc3 A2
#define adc4 A3
#define ledd 13
int flex2 = 0, flex1 = 0, flex3 = 0, flex4 = 0;
MPU6050 mpu;
void setup()
{
pinMode(ledd, OUTPUT);
digitalWrite(ledd, LOW);
Serial.begin(9600 );
Serial.println(“Initialize MPU6050”);
while (mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
{
Serial.println(“Could not find a valid MPU6050 sensor, check wiring!”);
delay(500);
}
checkSettings();
}
void checkSettings()
{
Serial.println();
Serial.print(" * Sleep Mode: “);
Serial.println(mpu.getSleepEnabled() ? “Enabled” : “Disabled”);
Serial.print(” * Clock Source: “);
switch (mpu.getClockSource())
{
case MPU6050_CLOCK_KEEP_RESET: Serial.println(“Stops the clock and keeps the timing generator in reset”); break;
case MPU6050_CLOCK_EXTERNAL_19MHZ: Serial.println(“PLL with external 19.2MHz reference”); break;
case MPU6050_CLOCK_EXTERNAL_32KHZ: Serial.println(“PLL with external 32.768kHz reference”); break;
case MPU6050_CLOCK_PLL_ZGYRO: Serial.println(“PLL with Z axis gyroscope reference”); break;
case MPU6050_CLOCK_PLL_YGYRO: Serial.println(“PLL with Y axis gyroscope reference”); break;
case MPU6050_CLOCK_PLL_XGYRO: Serial.println(“PLL with X axis gyroscope reference”); break;
case MPU6050_CLOCK_INTERNAL_8MHZ: Serial.println(“Internal 8MHz oscillator”); break;
}
Serial.print(” * Accelerometer offsets: “);
Serial.print(mpu.getAccelOffsetX());
Serial.print(” / “);
Serial.print(mpu.getAccelOffsetY());
Serial.print(” / ");
Serial.println(mpu.getAccelOffsetZ());
Serial.println();
}
void loop()
{
flex1 = analogRead(adc1);
flex2 = analogRead(adc2);
flex3 = analogRead(adc3);
flex4 = analogRead(adc4);
delay(10);
Vector rawAccel = mpu.readRawAccel();
Vector normAccel = mpu.readNormalizeAccel();
Serial.print(" Xnorm = “);
Serial.print(normAccel.XAxis);
Serial.print(” Ynorm = “);
Serial.print(normAccel.YAxis);
Serial.print(” Znorm = “);
Serial.println(normAccel.ZAxis);
Serial.print(flex1);
Serial.print(”-");
Serial.print(flex2);
Serial.print("-");
Serial.print(flex3);
Serial.print("-");
Serial.print(flex4);
delay(100);
Serial.println(" ");
//////////////////////// 1////////////////////////////////
if ((flex1 > 1012) && (flex2 > 1000) && (flex4 > 1000) && (normAccel.YAxis > 3))
{
{
Serial.println(“Need Medicine Immediately”);
}
}
else if ((flex1 > 1011) && (flex2 < 990) && (flex4 > 1000) && (normAccel.XAxis > 3))
{
{
Serial.println(“I Am Hungry”);
}
}
else if ((flex1 < 1011) && (flex4 < 990) && (normAccel.XAxis > 3))
{
{
Serial.println(“I Can Do It”);
}
}
else if ((flex1 > 1011) && (flex2 < 990) && (flex4 < 990) && (normAccel.XAxis < 2) && (normAccel.YAxis < 2))
{
{
Serial.println(“I Need To Use Washroom”);
}
}
else if ((flex1 > 1011) && (flex2 < 990) && (flex4 > 1011) && (normAccel.XAxis < 2) && (normAccel.YAxis < 2))
{
{
Serial.println(“Fine”);
}
}
else if ((flex1 < 1011) && (flex2 < 990) && (flex4 > 1011) && (normAccel.XAxis > 3))
{
{
Serial.println(“Need Help Emergency”);
}
}
else if ((flex1 > 1011) && (flex2 > 1000) && (flex4 < 990) && (normAccel.YAxis > 4))
{
{
Serial.println(“Hello”);
}
}
else if ((flex1 > 1011) && (flex2 < 990) && (flex4 > 1011) && (normAccel.YAxis > 4))
{
{
Serial.println(“K Bye.”);
}
}
else if ((flex1 < 1012) && (flex2 > 1011) && (flex4 > 1011) && (normAccel.YAxis < 2))
{
{
Serial.println(“Need Water”);
}
}
digitalWrite(ledd,LOW);
if(normAccel.XAxis>3){Serial.println(“listen up”);}
else if(normAccel.XAxis<-3){Serial.println(“hello”);}
else if(normAccel.YAxis>3){Serial.println(“i can do it”);}
else if(normAccel.YAxis<-3){Serial.println(“i am determind”);}
else
{
digitalWrite(ledd,HIGH);
if(normAccel.XAxis>3){Serial.println(“how are you”);}
else if(normAccel.XAxis<-3){Serial.println(“FAN”);}
else if(normAccel.YAxis>3){Serial.println(“need help”);}
else if(normAccel.YAxis<-3){Serial.println(“breathing problem”);}
}
delay(1800);
}
After uploading, do you see the message "Initialize MPU6050" in the serial monitor?
Do you see the message "Could not find a valid MPU6050 sensor, check wiring!" repeating every 500mS?
Or any other serial messages in the serial monitor?
No, there is no such message after uploading. I have posted error message, pls check it
Which Bluetooth module do you have and how is it connected to the Uno ?
Which program lines in your code are used for dealing with Bluetooth data ?
bluetooth module HC-05's pins are connected to arduino uno; i.e: RX,TX pin of bluetooth is connected to TX,RX pin of arduino uno.
khushi286:
bluetooth module HC-05's pins are connected to arduino uno; i.e: RX,TX pin of bluetooth is connected to TX,RX pin of arduino uno.
It really is not a good idea to use pins 0 and 1 of the Uno unless you know exactly what you are doing because they are used by the hardware serial interface that the Serial monitor depends on
It is better to use the SoftwareSerial library and 2 other pins of your choice to communicate with the Bluetooth module. There SofttwareSerial examples in the IDE
You've got a prefect code for the dead.....
system
closed
June 8, 2021, 8:52pm
#12
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.