Pages: [1] 2   Go Down
Author Topic: How to write the program codes to have a wireless LCD connection?  (Read 1211 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello.
I'm new here.
I have this project which a temperature sensor will transmit its data through wireless to the receiver which is a LCD.
But I do not know how to program it.
So I would like to know how do I write the codes at the transmitter side and the receiever side.
Meaning the temperature will sense its temperature and send it wirelessly and the LCD will display the temperature on the receiver side.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25809
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So I would like to know how do I write the codes at the transmitter side and the receiever side
To a large extent, that would depend on your radio hardware.
The VirtualWire library is a useful start.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Leeds, UK
Offline Offline
Edison Member
*
Karma: 78
Posts: 1719
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It also depends largely on what LCD you have, and how it would normally be connected to the arduino (if it were wired, rather than wireless)
Logged

~Tom~

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm using a LCD 16x2.
My temperature sensor will be connected to one arduino board and the LCD will connect to the other arduino board. Both with Xbee on the arduino board.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm using a LCD 16x2.
Nowhere near enough detail.

Quote
My temperature sensor will be connected to one arduino board and the LCD will connect to the other arduino board.
Have you got anything working when the boards are connected by wires?

Quote
Both with Xbee on the arduino board.
Have you tried to plug an XBee into the Arduino board? Have you noticed that they don't fit? What are you doing about that?

What kind of XBees are they? How have you configured them?

We don't charge by the number of characters you type.
Logged

Leeds, UK
Offline Offline
Edison Member
*
Karma: 78
Posts: 1719
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ahh, so basically what you are trying to do, is read in the temperature with one arduino, then use Serial.print() to send the reading through the xBees (which would act as a wireless serial link).
On the other side, you would use Serial.read() to read in from the xBee, and then print what is recieved to the LCD.
Logged

~Tom~

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yup. Thats what I wanted to do. Also to use lcd.println to display the temperature on the LCD.
But I do not know how to write the codes out. Could you or anyone help me?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Could you or anyone help me?
How much more help do you need?

You've been told that you need to tell us what XBees you have, how they are connected (what hardware is being used), and how they are configured. You haven't.

You've been told that if you have the XBees connected to the serial port, which is the usual case, that you need to use Serial.print() to send and Serial.read() to receive. EXACTLY THE SAME AS IF THE DEVICES WERE WIRED.

Yet, you've made no attempt to help yourself.

When is our homework due?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's the picture of the XBees and connection I have done. I will show the codes here so if there's any error to it, can let me so i can make changes.

This first picture is the transmitter.
 I've connected the TMP36 temperature sensor to the arduino and Xbee.
One pin to 5V, one to GND and the other to analog pin0
And here's the code:

//#include <LiquidCrystal.h>

int sensorPin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
                  //the resolution is 10 mV / degree centigrade with a
                  //500 mV offset to allow for negative temperatures

//LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()
{
  Serial.begin(9600); 
}

void loop()
{
  //getting the voltage reading from the temperature sensor
  int reading = analogRead(sensorPin); 
 
  // converting that reading to voltage, for 3.3v arduino use 3.3
  //lcd.setCursor(0,1);
  float voltage = reading * 5.0;
  voltage /= 1024.0;
 
  // print out the voltage
  Serial.print(voltage);
  Serial.println("volts");
 
  //lcd.clear();
  //lcd.setCursor(0,0);
 
  // now print out the temperature
  float temperatureC = (voltage - 0.5) * 100 ;  //converting from 10 mv per degree wit 500 mV offset
 
  //to degrees ((volatge - 500mV) times 100)
  Serial.print(temperatureC);
  Serial.println("degreesC");
 
  // now convert to Fahrenheight
  //float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
  //lcd.print(temperatureF);
  //lcd.println(" degrees F");
 
  delay(5000);  //waiting 5 second
}




* IMG_1386.JPG (2466.27 KB, 2592x1936 - viewed 26 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Arduino board i'm using is the Arduino Uno Board.

This 2nd picture is the receiver.
I've connected the LCD and the 10K potentiometer
pin 1 & 5 of LCD is GND, pin2 is to 5V, pin3 to one of 10K pot pin, pin4 to 12 of arduino, pin6 to 11 of arduino
pin 11,12,13,14 to pin 5,4,3,2 of arduino
Here's the code:

#include <LiquidCrystal.h>

LiquidCrystal lcd(12,11,5,4,3,2);
int incomingByte = 0;

void setup() {
 
  lcd.begin(16,2);
  Serial.begin(9600);
  //pinMode(2, OUTPUT);
  //pinMode(3, OUTPUT);
 
}

void loop()  {
 
  if(Serial.available() > 0 )
  {
    incomingByte = Serial.read();
 
   if(incomingByte >= 30)
   {
    lcd.println("Fever!");
    //digitalWrite(2, HIGH);
    //digitalWrite(3, HIGH);
   }
 
   else if (incomingByte < 30)
   {
    lcd.print("Ok!");
   }
  }
}


* IMG_1387.JPG (2486.23 KB, 2592x1936 - viewed 23 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm new here and need alot of help as this is my first time doing Arduino.
This project I'm doing is due on 17th Aug but i need a week to do my report and presentations therefore by 10th Aug I must complete.

After being able to connect the LCD wirelessly, I must combine the LCD, LED and Buzzer together to be wireless.
So my transmitter will only be the temperature sensor TMP36
My receiver will be LCD, LED and Buzzer together with a GSM Modem to send message
and it must be able to work with wireless connection.

I have the LED,Buzzer and GSM modem codes combined together but I just do not know how to add the LCD wireless codes into it.

But here's the codes for the combined LED, Buzzer and GSM modem. If anyone know how to add in the LCD codes to merge together please let me know ASAP. Thanks so much.

const int ledPin = 13; // the pin that the LED is attached to
char incomingByte;      // a variable to read incoming serial data into

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // see if there's incoming serial data:
  if (Serial.available() > 0) {
    // read the oldest byte in the serial buffer:
    incomingByte = Serial.read();
    // if it's a capital H (ASCII 72), turn on the LED:
    if (incomingByte == 'H') {
      digitalWrite(ledPin, HIGH);
      delay(1000);
      digitalWrite(ledPin, LOW);
      //Serial.println("AT");
      //delay(1000);
      Serial.println("AT+CMGF=1"); //set the modem to text mode
      delay(1000);   
      Serial.println("AT+CSCA=\"+6596400001\"");  //message centre number
      delay(1000);
      Serial.print("AT+CMGS="); // set reveiver number
      Serial.write(byte(34)); // send the " char
      Serial.print("+6592259569"); // receiver number
      Serial.write(byte(34)); // send the " char
      Serial.println(); 
      delay(1000);
      Serial.print("SOS");     // the SMS body
      delay(500);
      Serial.write(byte(26));
    }
    // if it's an L (ASCII 76) turn off the LED:
    if (incomingByte == 'L') {
      digitalWrite(ledPin, LOW);
    }
    //Serial.write(incomingByte); //print the text on serial monitor:
  }
}
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
But here's the codes for the combined LED, Buzzer and GSM modem. If anyone know how to add in the LCD codes to merge together please let me know ASAP. Thanks so much.
You seem to expect to be able to connect two things to the serial port on the Arduino. That ain't going to happen.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm...then is there anyway I can do it?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Hmm...then is there anyway I can do it?
Connect the GSM to another set of pins, and use SoftwareSerial.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What do u mean by connecting it to another set of pins?
Logged

Pages: [1] 2   Go Up
Jump to: