Reading serial data on lcd

Hello friends!

In the beginning, i know this is answered many times here, on the forum but it seems that i can't find solution for my simple problem... probably because i'm not good at programing at all.... :smiley:

Anyway,

I created a little gadget for my solar panel installation, i'm measuring load and charge with arduino nano, ACS hall efect sensors and i'm sending data over bluetooth to my PC.
I't works ok, but now i want to to display that data on the another arduino with LCD attached, i established communication between arduinos, but i'm getting problems with sending and receiving strings, converting them, etc... didn't manage to find solution to transfer three float numbers over the serial and to display them on the LCD... tried so many examples, but nothing, every example i found is with Processing code on the display side...

Help please.... :slight_smile:

Regards!

Consider sending the float values as raw 32 bit values, separated into four bytes. It will save you the headache of binary to string and string to binary conversion on each end.

dejanb:
Hello friends!

In the beginning, i know this is answered many times here, on the forum but it seems that i can't find solution for my simple problem... probably because i'm not good at programing at all.... :smiley:

Anyway,

I created a little gadget for my solar panel installation, i'm measuring load and charge with arduino nano, ACS hall efect sensors and i'm sending data over bluetooth to my PC.
I't works ok, but now i want to to display that data on the another arduino with LCD attached, i established communication between arduinos, but i'm getting problems with sending and receiving strings, converting them, etc... didn't manage to find solution to transfer three float numbers over the serial and to display them on the LCD... tried so many examples, but nothing, every example i found is with Processing code on the display side...

Help please.... :slight_smile:

Regards!

I did this a long time ago. What I did was make a VIRTUAL LCD display (in my case, two "buffers" of 16 chars each for a 2 line LCD).

I used sprintf() to write my LCD data, then had a simple "update" function that copied the virtual LCD to the real screen.

I could also "copy" the contents of the virtual LCD to the Serial port simply by sending each byte as a hex string. That is, if the LCD screen had
** **"Hello           "** **
on it, the function would send out

[b]0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20[/b].

Then at the receiving end, I just pulled the string into a buffer and parsed out the hex numbers and sent them to the "remote" LCD.

I did rudimentary error checking by throwing a string away if any "0x" didn't come through.

Grumpy_Mike:
LiquidCrystal - Arduino Reference

Thanks but i know how to use LCD library, it's not the problem :slight_smile: i have problem with sending and receiving three float values over the serial and displaying then onto the LCD.

Regards!

dejanb:
I't works ok, but now i want to to display that data on the another arduino with LCD attached, i established communication between arduinos, but i'm getting problems with sending and receiving strings, converting them, etc... didn't manage to find solution to transfer three float numbers over the serial and to display them on the LCD

How many serial ports do your two Arduino boards provide?

As the first serial port "Serial" is typically reserved for the serial connection from the Arduino to a PC via USB, you will need to have two or more serial ports on your Arduino boards when connecting two Arduino boards.

For example MEGA2560 boards have four hardware serial ports, so you could connect one MEGA2560 with threee other Arduino boards using Serial1, Serial2, Serial3.

If your board provides not enough hardware serial ports (like UNO), you would have to use a "software serial" emulated port to connect two Arduino boards with a serial connection. But emulated serial ports have several disadvantages, such like requiring additional resources (timer, interrupts, execution time) to emulate serial hardware in software and also are limited to relatively slow connection speed like perhaps 9600 baud (= 960 characters per second maximum transfer speed).

jurs:
How many serial ports do your two Arduino boards provide?

As the first serial port "Serial" is typically reserved for the serial connection from the Arduino to a PC via USB, you will need to have two or more serial ports on your Arduino boards when connecting two Arduino boards.

For example MEGA2560 boards have four hardware serial ports, so you could connect one MEGA2560 with threee other Arduino boards using Serial1, Serial2, Serial3.

If your board provides not enough hardware serial ports (like UNO), you would have to use a "software serial" emulated port to connect two Arduino boards with a serial connection. But emulated serial ports have several disadvantages, such like requiring additional resources (timer, interrupts, execution time) to emulate serial hardware in software and also are limited to relatively slow connection speed like perhaps 9600 baud (= 960 characters per second maximum transfer speed).

Hello!

Arduino nano has one serial port, but it's not the problem, i attached bluetooth HC-05 module to the serial, it works ok between arduinos, when i need to program arduino i disconnect bluetooth module, then i reconnect it again and everything works.

Problem is in the software, i dont know how to create array of data and then convert that data to variables, so i can display them on the LCD, etc...
Everything that depends on the hardware is ok, i have some knowledge of electronic, i did earlier some arduino projects...

Regards!

Problem is in the software,

Then why did you not post this in the programming section of the forum?

Grumpy_Mike:
Then why did you not post this in the programming section of the forum?

Because i made a mistake, i see now... Anyway, moderator can move topic anytime.

Reards!

i dont know how to create array of data and then convert that data to variables, so i can display them on the LCD, etc...

Unless you want to manipulate the data, there is no reason to send variables, just send a print image of ASCII and display that on an Arduino+LCD that is a "serial terminal." We see this in many Bluetooth modem examples.

The receiving display end could look like this...

Or, even on a GLCD dumb-display.

If you need access to the variables on the receiving Arduino, you can:

  1. Send the variables as a struct, or
  2. Parse out what you need from the received ASCII string.

In #1, you can find examples in serveral of the RF24L01/RF69 examples or Zigbee, or Bluetooth modem.

In #2, I use the parsing technique in my GPS over ESP8266 Arduino code which you may find interesting.
Ray