"Hand Talk Project"

Hello, i am a student and i'm in need of help.

1. State exactly what the problem is.

  • i tested the flex sensors and LCD (16x2) screen and it's working. The problem is how can i connect them with code? i tried alot of codes and the message that i want to appear in the LCD is not showing.

2. State which sensors you are using and provide a link to them.

3. If you are following an online tutorial, provide a link to that.

4. Provide a wiring diagram (or a link to an existing one if you are using that)

GND (LCD) is connected to GND (arduino uno r3)
VCC (LCD) is connected to 5V (arduino uno r3)
SDA (LCD) is connected to A4 (arduino uno r3)
SCL (LCD) is connected to A5 (arduino uno r3)

and for the flex sensor, i used breadboard to connect it (im using 1 flex sensor (2.2) for now)
so here's what i did: Flex Sensor Hookup Guide - SparkFun Learn

  1. Post the code you are using.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int flexPin1 = A0;
int value1;
void setup() {
 // put your setup code here, to run once:
 lcd.begin(16, 2);
 lcd.setCursor(0, 0);
 lcd.print("Sign Language");
 Serial.begin(9600);
 delay(200);
}

void loop() {
 // put your main code here, to run repeatedly:
 value1 = analogRead(flexPin1);
 Serial.print(value1);
 if (value1 > 150)
 {
   lcd.setCursor(0, 1);
   lcd.print("             ");
   lcd.setCursor(0, 1);
   lcd.print("Food");
   digitalWrite(6, HIGH);
   Serial.println("   Food");
   delay(500);
 }
 else
 {
   lcd.setCursor(0, 1);
   lcd.print("             ");
   lcd.setCursor(0, 1);
   lcd.print("Sign Language");
   lcd.clear();
   digitalWrite(6, LOW);
   Serial.println("   Sign Language");
   delay(500);
 }

}

above is the current code im trying to work on, since ive found he used this code (we have the same project)

if you are going to ask me the materials i only have here:

And while you are at it ...

You need to go and read the forum instructions so that you can go back and modify your original post (not re-post it) - using the "More -> Modify" option below the right hand corner of your post - to mark up your code as such using the "</>" icon in the posting window. Just highlight each section of code (or output if you need to post that) from the IDE and click the icon.

In fact, the IDE itself has a "copy for forum" link to put these markings on a highlighted block for you so you then just paste it here in a posting window. But even before doing that, don't forget to use the "Auto-Format" (Ctrl-T) option first to make it easy to read. If you do not post it as "code" it can easily be quite garbled and is always more difficult to read due to the font.

It is inappropriate to attach it as a ".ino" file unless it is clearly too long to include in the post proper. People can usually see the mistakes directly and do not want to have to actually load it in their own IDE. And even that would also assume they are using a PC and have the IDE running on that PC.

Also ensure your blank space is tidy. Do use blank lines, but only single blanks between complete functional blocks.


So, when you say "the message that I want to appear in the LCD is not showing", what do you mean?

i'm sorry, i'm just new here. How can i edit my post?
what i mean is once i bend the flex sensor (2.2) the word will appear in the LCD screen (16x2)

Do you see anything at all in the LCD display ? For example, do you "Sign Language" when the sketch first starts ?

Also, using Serial.print() is a good way of debugging such a sketch so, for example, you can see the analog values returned when you bend the sensor.

Looks as if you figured out the instructions to edit!

Please describe what does and what does not appear on the LCD. Is it working at all? Did you test it with the "Hello World" example?

(I'm off to bed!)

The LCD display is working at all, i tested it.

The flex sensor (2.2) is suppose to be the controller, once bent, the word will appear in the LCD, but it is not.

is there a problem in my circuit or coding.

can you atleast provide the proper circuit and coding.

Everyone here, re-read my post and look at the number 3, that's what i'm trying to make but without speaker.

Can anyone provide me a new wiring together with a code?

Thank you in advance.

Is there any clarification? please let me know.

im trying my best to explain these stuff.

(I have to pass my subject or else im so dead)

Thank you in advance.

What does the Serial print show for value1?

If you change the analogRead to a fixed value, do you see the correct output on the display?

//value1 = analogRead(flexPin1);
value 1 = 200;

The Spark Fun circuit you posted looks correct.

Apart from the obvious blunder that lcd.clear(); should not be called after writing something, it is most unlikely that it should appear in loop() at all as the loop is repeated at a (very) rapid rate and lcd.clear() takes significant time so the display will spend much of its time cleared and appear to flicker.

You should not be using delay() either as it prevents anything happening! :astonished: (Two frequent "newbie" mistakes. :grinning: )

You see, what your code should be doing, is checking whether anything has changed since the last pass through the loop. If nothing has changed, you just drop through and let the loop run again. If one of your inputs has changed, then you need to decide whether the change is meaningful which includes whether the change is sustained or not (this is called "de-bouncing") and only then do you take action such as updating the display by (setting the cursor and) writing over all of the text you need to replace.

Determining whether a change is sustained or not is performed by marking the system time ("millis()") when you first detect the change, and re-checking on every pass through loop() until millis() has advanced by a reasonable time (such as 10 milliseconds) and cancelling the check and timer if at any point the change reverts. :sunglasses:

Hello again, i'm sorry if im so noob and new at this field.

i dont want to fail my class.

So, here's my updated code:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int flexPin1 = A0;
int value1;
void setup() {
 // put your setup code here, to run once:
 lcd.begin(16, 2);
 lcd.setCursor(0, 0);
 lcd.print("Food");
 Serial.begin(9600);
}

void loop() {
 // put your main code here, to run repeatedly:
 value1 = analogRead(flexPin1);
 Serial.print(value1);
 if (value1 > 150)
 {
   lcd.setCursor(0, 1);
   lcd.print("             ");
   lcd.setCursor(0, 1);
   lcd.print("Food");
   digitalWrite(6, HIGH);
   Serial.println("   Food");
 }
 else
 {
    lcd.setCursor(0, 1);
    lcd.print("             ");
    lcd.setCursor(0, 1);
    lcd.print("Food");
    //lcd.clear(); <<<<<<<<<<<<<
    digitalWrite(13, LOW);
    Serial.println("   Food");
  }

}

i removed the "delay" and followed what you guys saying.

it's still not working.

the flex sensor is suppose to be the controller (If i bend the flex sensor, the message "Food" should appear in the LCD screen, but it is not working)

i changed all the "Sign language" to "Food"

Is there any wrong with my wiring and code? please let me know.

or just provide me the wiring and the right code.

so, that we can test it out, if it's working to me.

Thank you in advance.

@cattledog

i changed the analogRead to a fixed value just like what you said

and it is still not working.

Goal:
-If you bend the flex sensor the word "Food" will appear in the LCD display
but it is not working

Below is the code that i'm currently working on:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int flexPin1 = A0;
int value1;
void setup() {
 // put your setup code here, to run once:
 lcd.begin(16, 2);
 lcd.setCursor(0, 0);
 lcd.print("Food");
 Serial.begin(9600);
 delay(200);
}

void loop() {
 // put your main code here, to run repeatedly:
 value1 = 600;
 Serial.print(value1);
 if (value1 > 150)
 {
   lcd.setCursor(0, 1);
   lcd.print("Food");
   lcd.setCursor(0, 1);
   lcd.print("Food");
   digitalWrite(6, HIGH);
   Serial.println("   Food");
   delay(200);
 }
 else
 {
    lcd.setCursor(0, 1);
    lcd.print("Food");
    lcd.setCursor(0, 1);
    lcd.print("Food");
    //lcd.clear(); <<<<<<<<<<<<<
    digitalWrite(13, LOW);
    Serial.println("Food");
    delay(200);
  }

}

Here is the circuit/wiring that i made:

GND (LCD) is connected to GND (arduino uno r3)
VCC (LCD) is connected to 5V (arduino uno r3)
SDA (LCD) is connected to A4 (arduino uno r3)
SCL (LCD) is connected to A5 (arduino uno r3)

and for the flex sensor, i used breadboard to connect it (im using 1 flex sensor (2.2) for now)

so here's what i did: Flex Sensor Hookup Guide - SparkFun Learn

Does the LCD work by itself with the examples that come with the LiquidCrystal library?

Can you get realistic values in serial monitor when you bend the flex sensor? How is the flex sensor wired?

In the posted code you never read the flex sensor and the same thing is printed if value1 is greater, equal to or less than 150. The only thing different is the LED state.

I think that you are clearing the display with blanks and then printing the word with each pass. This is happening very quickly, and the word is not showing properly.

As others have said, you need to clear the display and update it when something changes, but for now try this

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int flexPin1 = A0;
int value1;
void setup() {
 // put your setup code here, to run once:
 lcd.begin(16, 2);
 lcd.setCursor(0, 0);
 lcd.print("Food");
 Serial.begin(9600);
}

void loop() {
 // put your main code here, to run repeatedly:
 value1 = analogRead(flexPin1);
 Serial.print(value1);
 if (value1 > 150)
 {
   lcd.setCursor(0, 1);
   //lcd.print("             ");
   //lcd.setCursor(0, 1);
   lcd.print("Food");
   digitalWrite(6, HIGH);
   Serial.println("   Food");
 }
 else
 {
    lcd.setCursor(0, 1);
    //lcd.print("             ");
    //lcd.setCursor(0, 1);
    lcd.print("Food");
    //lcd.clear(); <<<<<<<<<<<<<
    digitalWrite(13, LOW);
    Serial.println("   Food");
  }

}

No, i dont see any value appearing in the LCD.

here is the values shown in serial monitor:

Food
600   Food
Food
600   Food
Food
600   Food
Food
600   Food
Food
600   Food
Food
600   Food
Food
600   Food
Food
600   Food
Food
600   Food
Food
600   Food
Food
600   Food
Food
600   Food
Food
600   Food
Food
600   Food
Food
600   Food
Food
600   Food
Food
600   Food

Here is the circuit/wiring that i made:
LCD

GND (LCD) is connected to GND (arduino uno r3)
VCC (LCD) is connected to 5V (arduino uno r3)
SDA (LCD) is connected to A4 (arduino uno r3)
SCL (LCD) is connected to A5 (arduino uno r3)

and for the flex sensor wiring, i used breadboard to connect it (im using 1 flex sensor (2.2) for now)

so here's what i did: Flex Sensor Hookup Guide - SparkFun Learn

What did the I2C scanner report about the attached devices?

nothing,

i did the circuit diagram and the coding but the problem is

the flex sensor is not controlling the the LCD,

supposedly, if you bend the sensor, the word "Food" will appear in the LCD, but it's not working.

You are using wrong library. See the detail instruction in this Arduino - LCD I2C tutorial

Hello,

this is my past post: "Hand Talk Project" - Project Guidance - Arduino Forum

and this is what im trying to do: Hand Talk Using Flex Sensor With Voice Output - YouTube But without speaker, only LCD

Can you please, provide me the proper code for that project?

Thank you in advance, bless you.

Please.