Poll
Question: I used LCD 16x2, what is the simple way of coding the output from sensor to be display by LCD?
 and briefly what does this coding mean "val = map(val, 0, 1023, 0, 225);" please kindly help ^^ 2 (50%) and briefly what does this coding mean "val = map(val, 0, 1023, 0, 225);" please kindly help ^^ 2 (50%)
Total Voters: 4

 Pages: [1]   Go Down
 Author Topic: Sensor Hall effect display in LCD  (Read 2102 times) 0 Members and 1 Guest are viewing this topic.
Malaysia
Offline
Newbie
Karma: 0
Posts: 6
 « on: May 05, 2012, 01:06:26 pm » Bigger Smaller Reset

I'm newbie with arduino Uno,
I used LCD 16x2, what is the simple way of coding the output from sensor to be display by LCD?
and briefly what does this coding mean "val = map(val, 0, 1023, 0, 225);" please kindly help ^^
 Logged

Global Moderator
Netherlands
Online
Shannon Member
Karma: 227
Posts: 14041
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #1 on: May 05, 2012, 01:32:05 pm » Bigger Smaller Reset

val = map(val, 0, 1023, 0, 225);

this line of code means : do a linear interpolation of the value of val with range( 0..1023) to a range (0..225)

examples
if val == 0  it will map upon 0
if val == 1023 it will map upon 225
if val ==  512 it will map upon 112
if val == 256 it wil map upon 56
if val == 768 it will map upon 168

etc.

 Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Malaysia
Offline
Newbie
Karma: 0
Posts: 6
 « Reply #2 on: May 05, 2012, 07:43:13 pm » Bigger Smaller Reset

Okey, tq robtilaart^^
Any suggestion on LCD display? I have trouble to use input from sensor to be display..
 Logged

Central MN, USA
Offline
Tesla Member
Karma: 76
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
 « Reply #3 on: May 05, 2012, 09:36:32 pm » Bigger Smaller Reset

Okey, tq robtilaart^^
Any suggestion on LCD display? I have trouble to use input from sensor to be display..

OK, did your LCD work with example code? The word "trouble" is just 7 characters. It doesn't say much about what you are doing, what works and what doesn't work, not to mention you don't provide code either. Do better next time you ask a question.
 Logged

Malaysia
Offline
Newbie
Karma: 0
Posts: 6
 « Reply #4 on: May 05, 2012, 10:34:12 pm » Bigger Smaller Reset

Sorry my question is not clear..
this is example coding of my hall effect sensor, I'm using Arduino UNO..
sensor input is attach to pin 7
#include <LiquidCrystal.h>
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("the rpm now is....");
lcd.printIn(rpm, DEC);
So, the question is how i want to display the value from my pin 7 to the LCD? or it already...
 Logged

Central MN, USA
Offline
Tesla Member
Karma: 76
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
 « Reply #5 on: May 06, 2012, 12:55:35 am » Bigger Smaller Reset

OK. I feel better about this already. What is the hall sensor supposed to do? Does it sense some speed or does it tell jokes to you? Don't make me guess. I don't guess well. Is there some other language you can use other than English?
 Logged

Anaheim CA.
Offline
Karma: 48
Posts: 2935
...
 « Reply #6 on: May 08, 2012, 07:39:43 pm » Bigger Smaller Reset

I thought "Jokes" were inappropriate here...

Doc
 Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Central MN, USA
Offline
Tesla Member
Karma: 76
Posts: 7305
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
 « Reply #7 on: May 08, 2012, 07:58:23 pm » Bigger Smaller Reset

I know I know. How about using analogy such as the OP feels like a hardened old tube of tooth paste? You squeeze so hard and only get so little each time. That was pretty much what I got. Ridiculously little information. There is no back ground story of what OP was trying to do, virtually no description of what exact hardware was used and what the actual goal was. If the OP has language barrier, there is a thing called google translate. It does a good job.
 Logged

Western New York, USA
Offline
Karma: 41
Posts: 4435
 « Reply #8 on: May 08, 2012, 08:35:13 pm » Bigger Smaller Reset

Here are a few pointers.
You want this part in setup because it doesn't ever change.

Code:
lcd.print("the rpm now is....");

You want this part in loop because it does change
Code:
lcd.printIn(rpm, DEC);

BUT - you don't want to use lcd.println() because it does not do what you expect it to, which is why it is not listed in the LiquidCrystal library documentation.
AND- you will have to do some cursor positioning to get the updated values to overwrite the older values.

Don

:  When you put his code in a code box you see that he used lcd.printIn, not lcd.println.  That's not in the LiquidCrystal library either.
 « Last Edit: May 08, 2012, 08:40:46 pm by floresta » Logged

Malaysia
Offline
Newbie
Karma: 0
Posts: 6
 « Reply #9 on: May 10, 2012, 07:48:45 pm » Bigger Smaller Reset

floresta..
so i see, the data cannot overwrite with the past data right? does you mean the addition of cursor will help updated the rpm? and my motor already work, just that it can not display lcd.print..is it because serial.print cannot use together with lcd.print?
 Logged

Malaysia
Offline
Newbie
Karma: 0
Posts: 6
 « Reply #10 on: May 24, 2012, 11:27:22 pm » Bigger Smaller Reset

i have last question.      rpm = 30*1000/(millis() - timeold)*rpmcount;> what does this define? why 30 multiply by 1000 in this code? one revolution is 2 pai right?
 Logged

Malaysia
Offline
Newbie
Karma: 0
Posts: 6
 « Reply #11 on: May 26, 2012, 12:24:54 pm » Bigger Smaller Reset

anyone can describe this formula plzz
if (rpmcount >= 20) {
//Update RPM every 20 counts, increase this for better RPM resolution,
//decrease for faster update
rpm = 30*1000/(millis() - timeold)*rpmcount;
timeold = millis();
rpmcount = 0;
Serial.println(rpm,DEC);}
-the question is, Do we need to multiply 30 in the formula??
 Logged

Global Moderator
Netherlands
Online
Shannon Member
Karma: 227
Posts: 14041
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #12 on: May 27, 2012, 09:00:29 am » Bigger Smaller Reset

wild guess mode

30 has to do with calculating the rounds per minute
30* 1000 sounds like halve a minute so somewhere a factor 2 was smuggled in (2 magnets, 2 pulses per RPM, 2 sensors or so)

 Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline
Newbie
Karma: 0
Posts: 10
 « Reply #13 on: June 13, 2013, 05:13:47 pm » Bigger Smaller Reset

Ola pessoal preciso fazer o programa abaixo sesnor de efeito hall para jogar no display 1602

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int hallPin=13;
int statePin=LOW;

void setup()
{
lcd.begin(16, 2);
lcd.print("ROTACAO");
pinMode(hallPin,INPUT);
Serial.begin(9600);
}
void loop()
{
if (Serial.available())
{
if( statePin==HIGH)
{
Serial.println("North");
}
else if(statePin==LOW)
{
Serial.println("South");
lcd.setCursor(1, 1);
}
}
delay(500);
}
 Logged

 Pages: [1]   Go Up