Hi all. I am getting started with Blynk and started to apply it today to one of my projects, a home theater automation, cooling and power control system. Everything I have so far was working great except for my LCD output. I was able to narrow down the issue to when the Blynk.begin (auth); is run. Depending on the order I either get the entire top line all white boxes (if the LCD startup line is before Blynk) or just a blank screen (if the LCD setup line is after Blynk).
Do you use the internal Arduino power of an external power supply to power your LCD? It can take a bunch a of power so I’d recommend using an external one.
What type of display and what library are you using?
I am using an external power source and powering via the VIN port on the Arduino. I can try a more robust Power supply, I think this one is 12V 2A and I am using the 5V output on the Sainsmart relay for the 5V stuff. The 12V is to power a couple of cooling fans. Using LiquidCrystal.h and the 16,2 that came in the Arduino Cana Kit LCM1602C V21. I have a 5V leg on my power supply that is also 2AMP, maybe I will switch to that and see if it makes a difference. In the meantime if you have other thoughts let me know and thanks for responding! -J
I’m using the same library and if works perfectly. I use an external 12v supply with a DX.com convertor to make 5v from it. Mine has an integrated FunDuino driverboard so I use I2C to talk it.
I tested it with the 2A 5V leg of the PS running the 5V side of things including the Arduino and LCD, no joy unfortunately.
That’s cool you are using I2C, I am very interested in playing with that, I plan to use a second Arduino for the IR functions and use I2C to handle the communications between devices.
I don’t really need the LCD but I want it, if you know what I mean.
Lol, yes I know. I2C is great for short range inter-device communication.
In what order do you initialize all your stuff? Can you post the code snippet from your setup loop?
Here is everything I have right now…
I should note, I tried bringing blynk out into it’s own timer also… didn’t make a difference.
// included library code:
#include <LiquidCrystal.h>
#include <SimpleTimer.h>
#include <SPI.h>
//#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(53, 52, 51, 50, 49, 48);
char auth[] = "supersecretcode";
// temperature sensor goodies
const int sensorPin = A14;
const int sensorPin2 = A15;
const float baselineTemp = 18.0;
// Relays that are used to control the power to all the network devices
#define RELAY1 22 // 1 on Sainsmart Powers Outlet 1 on HTS3600
#define RELAY2 23 // 2 on Sainsmart Powers Outlet 2 on HTS3600
#define RELAY3 24 // 6 on Sainsmart Powers Outlet 3 on HTS3600
#define RELAY4 25 // 7 on Sainsmart Powers Outlet 4 on HTS3600
#define RELAY5 26 // 8 on Sainsmart Powers Outlet 5 on HTS3600
// Relay Output Pin for Cooling Fan Control to 12V Source
#define RELAY9 27 // 9 on Sainsmart Cabinet Cooling Fan
#define RELAY10 28 // 10 on Sainsmart Power Unit Cooling Fan
// There must be one global SimpleTimer object.
SimpleTimer timer;
//Blynk Serial Print
#define BLYNK_PRINT Serial
void FanLCDTask() {
//Our main temperature and LCD controls running every 10 seconds here:
// read sensor value for 2xTMP36
int sensorVal = analogRead(sensorPin);
int sensorVal2 = analogRead(sensorPin2);
// set the cursor to column 0, line 1
lcd.setCursor(0, 0);
//convert the ADC rating to voltage
float voltage = (sensorVal/1024.0) * 5;
float voltage2 = (sensorVal2/1024.0) * 5;
// convert the voltage to temperature in degrees C
float temperatureC = (voltage - .5) * 100;
float temperatureC2 = (voltage2 - .5) * 100;
// convert to Farenheit
float temperatureF = (temperatureC * 9.0 / 5.25) + 32.0;
float temperatureF2 = (temperatureC2 * 9.0 / 5.75) + 32.0;
//display Temperature on LCD
lcd.print(temperatureF);
lcd.print((char)223);
lcd.print("F ");
Blynk.virtualWrite(0, temperatureF);
Blynk.virtualWrite(1, temperatureF2);
// don't need this anymore -> delay(1000);
// Cabinet Fan control
if (temperatureF >75)
{
digitalWrite(27,LOW);
lcd.setCursor (8,0);
lcd.print ("COOLING");
}
else
{
digitalWrite(27,HIGH);
lcd.setCursor (8,0);
lcd.print ("NORMAL ");
}
lcd.setCursor(0, 1);
{
lcd.print (temperatureF2);
lcd.print((char)223);
lcd.print("F ");
}
lcd.setCursor(8,1);
// print the days since reset:
lcd.print("UP");
lcd.print(millis() * 0.0000000115741);
// case cooling fan control
if (temperatureF2 >75)
{
digitalWrite(28,LOW);
}
else
{
digitalWrite(28,HIGH);
}
// End of FanLCD Actions
}
void setup() {
// timed actions setup
timer.setInterval(10000, FanLCDTask);
// relay pin definitions
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
pinMode(RELAY3, OUTPUT);
pinMode(RELAY4, OUTPUT);
pinMode(RELAY5, OUTPUT);
pinMode(RELAY9, OUTPUT);
pinMode(RELAY10, OUTPUT);
// these relays go on with "LOW" setting HIGH to start
digitalWrite(RELAY1,HIGH);
digitalWrite(RELAY2,HIGH);
digitalWrite(RELAY3,HIGH);
digitalWrite(RELAY4,HIGH);
digitalWrite(RELAY5,HIGH);
digitalWrite(RELAY9,HIGH);
digitalWrite(RELAY10,HIGH);
// Start Serial for Console Logging (When connected Temperature Results are NOT reliable)
Serial.begin(9600);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Blynk Login
Blynk.begin(auth); // Here your Arduino connects to the Blynk Cloud.
}
void loop() {
Blynk.run();
timer.run();
}
https://www.arduino.cc/en/Reference/Ethernet
“Arduino communicates with the shield using the SPI bus. This is on digital pins 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used as SS. On the Mega, the hardware SS pin, 53, is not used to select the W5100, but it must be kept as an output or the SPI interface won’t work.”
That’s exactly what it was, I moved it down below 42 and we are good now. Thanks for the help!