Go Down

Topic: Arduino as RF Transmiter with DS18b20 & LCD5110 (Read 405 times) previous topic - next topic

zawartek

Nov 22, 2019, 11:44 pm Last Edit: Nov 23, 2019, 12:35 pm by zawartek
Hello
I am making a simple project with Arduino Nano RF transmitter 433 MHz,DS18b20, LCD5110  which sends data to another arduino in another room.
The code  in attachment

The problem is that the LCD freezes and shows nothing. The transmitter works fine.
If i am using only LCD with ds18b20 the LCD works fine.

blh64

#1
Nov 23, 2019, 01:05 am Last Edit: Nov 23, 2019, 07:20 pm by blh64
Not sure which VirtualWire library you are using (there are several out there) but this one https://github.com/manashmandal/VirtualWire/tree/master/VirtualWire

has the default pins at 10,11,12.  You adjust these pin assignments, but *after* you call setup() which means during setup, the default values are used and initialized as inputs/outputs.  You should switch the order.  Set the pins, then call setup()

TomGeorge

#2
Nov 23, 2019, 11:55 am Last Edit: Nov 23, 2019, 11:55 am by TomGeorge
Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html .
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....

zawartek


TomGeorge

#4
Nov 23, 2019, 04:56 pm Last Edit: Nov 23, 2019, 04:59 pm by TomGeorge
Hi,
OPs circuit.

What are you using as a power supply?
What 433Mhz TX are you using?

Does the LCD fault occur when the TX is transmits or when you turn the controller ON with the TX in circuit.

Thanks.. Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....

TomGeorge

Hi,
OPs sketch;
Code: [Select]



#include <OneWire.h>
#include <DallasTemperature.h>
#include <LCD5110_Basic.h>
#define ONE_WIRE_BUS 2
LCD5110 myGLCD(8, 9, 10, 12, 11);
#include <VirtualWire.h>
extern unsigned char SmallFont[];
extern unsigned char BigNumbers[];
extern uint8_t temperatureIcon[];
char temperatureF[6];
// Tu wpisujemy temperaturę alarmu
float destinytemp = 80.0;
float alarmtemp = 75.0;
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float tempC = 0;
float tempF = 0;
/////////////dane dotyczące RF
char msg[10];
int Temperatura;
void setup()
{
  myGLCD.InitLCD();
  myGLCD.setFont(BigNumbers);
  sensors.begin();
  pinMode(3, OUTPUT);
  vw_setup(2000);
  vw_set_tx_pin(6);
  vw_set_ptt_pin(7); //dodano nic nie dało


  Serial.begin(9600);
}


void loop()
{


  myGLCD.clrScr();
  //lcd.drawBitmap(0, 0, temperatureIcon, 84, 48);
  sensors.requestTemperatures();
  tempC = sensors.getTempCByIndex(0);
  myGLCD.print(Temperatura, 25, 11);


  Temperatura = (int)tempC;
  Serial.println(Temperatura);
  itoa(Temperatura, msg, 10); ////zamiana integer na char , 10 -oznacza dziesiętne
  vw_set_ptt_pin(4);
  vw_send((uint8_t *)msg, strlen(msg));
  vw_wait_tx();
  delay(400);


  if (sensors.getTempCByIndex(0) >= alarmtemp)
    alarm();
  else digitalWrite(3, LOW);


}


void alarm()
{


  digitalWrite(3, HIGH);
  delay (20);
  digitalWrite(3, LOW);
  if (sensors.getTempCByIndex(0) >= destinytemp)
    digitalWrite(3, HIGH);
  else digitalWrite(3, LOW);


}



Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

cattledog

#6
Nov 23, 2019, 06:28 pm Last Edit: Nov 23, 2019, 06:29 pm by cattledog
@ blh 64 has pointed out the problem with a pin conflict between the display and the radio.

Code: [Select]
LCD5110 myGLCD(8, 9, 10, 12, 11);

Code: [Select]
vw_setup(2000);
vw_set_tx_pin(6);
vw_set_ptt_pin(7); //dodano nic nie dało


The Arduino pin number for vw receiving defaults to 11. It is set by the library to be an input. You should change it from pin 11 even if you are not receiving in the sketch.


blh64

#7
Nov 23, 2019, 07:23 pm Last Edit: Nov 24, 2019, 05:30 pm by blh64
@ blh 64 has pointed out the problem with a pin conflict between the display and the radio.

Code: [Select]
LCD5110 myGLCD(8, 9, 10, 12, 11);

Code: [Select]
vw_setup(2000);
vw_set_tx_pin(6);
vw_set_ptt_pin(7); //dodano nic nie dało


The Arduino pin number for vw receiving defaults to 11. It is set by the library to be an input. You should change it from pin 11 even if you are not receiving in the sketch.


And you need to reverse the order of the calls so the pins get assigned since the vw_setup() call is where they get set as INPUT/OUTPUT

Code: [Select]

vw_set_rx_pin(A0);  // some unused pin
vw_set_tx_pin(6);
vw_set_ptt_pin(7); //dodano nic nie dało
vw_setup(2000);

zawartek

Hi,
OPs circuit.

What are you using as a power supply?
What 433Mhz TX are you using?

Does the LCD fault occur when the TX is transmits or when you turn the controller ON with the TX in circuit.

Thanks.. Tom.. :)
The LCD FAULT at the begining. When I Turned it ON only blank screen with some grey shape.

I'LL Try to change some pins from LCD but the problem is that i made PCB :(
 
When i changed
vw_set_rx_pin(A0);  // some unused pin
vw_set_tx_pin(6);
vw_set_ptt_pin(7); //dodano nic nie dało
the only different is that the LCD Blink and disappeard

zawartek

As a supply i used DC - supply 12V

I disconnected the RF but nothing changed.

It look that the problem is the virtualwire library

zawartek

I have changed the pins for LCD. To be true I,am confused. The icon wchich i added is displayed but the temperature is printed as a random pixels

LCD5110 lcd(8, 4, 5, 7, 6);


zawartek

Ok . Finaly i made it work. Solution in sketch

Go Up