So I have a weather building station that I built with Arduino Zero -board and an ESP8266-board. For the past 4 days I have been struggling to get my weather results online (this is for a school project and presentation is tomorrow) since there is so little information about Arduino Zero. Yesterday I heard about Blynk and set everything up. Today I tried DHT11 example codes, copying that code both for ESP8266-board and Arduino Zero-board (since I’m not sure which board do I need to use to get my weather results to blynk using zero). So using Zero-board version, code simply compiles but doesnt do anything. By using ESP8266-board version the console says that it tries to connect (I’m using my phone hotspot so wifi) but eventually it times out. I have a LCD working with sensors so do I need to use ESP board for this so it doesn’t interfere with my LCD which has to work aswell.
Does anybody have experience with Zero to help me out? I can share the code for ESP here:
/*************************************************************
Download latest Blynk library here:
https://github.com/blynkkk/blynk-library/releases/latest
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials: http://www.blynk.cc
Sketch generator: http://examples.blynk.cc
Blynk community: http://community.blynk.cc
Follow us: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how value can be pushed from Arduino to
the Blynk App.
WARNING :
For this example you'll need Adafruit DHT sensor libraries:
https://github.com/adafruit/Adafruit_Sensor
https://github.com/adafruit/DHT-sensor-library
App project setup:
Value Display widget attached to V5
Value Display widget attached to V6
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "my authtoken";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "my ssid";
char pass[] = "my pw";
#define DHTPIN 5 // What digital pin we're connected to
// Uncomment whatever type you're using!
#define DHTTYPE DHT22 // DHT 11
//#define DHTTYPE DHT22 // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21 // DHT 21, AM2301
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V5, h);
Blynk.virtualWrite(V6, t);
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
dht.begin();
// Setup a function to be called every second
timer.setInterval(1000L, sendSensor);
}
void loop()
{
Blynk.run();
timer.run();
}
Your ESP8266 (presumably an ESP-01?) needs to be running the factory firmware that it was shipped with (know as AT firmware).
The code you write needs to be run on the Arduino, so you will choose the Arduino Zero board and ESP8266 WiFi shield as your connection method.
You’ll need to choose the SoftwareSerial port to connect your two devices together, and keep the SS baud rate to 9600. The ESP-01 needs to be configured to use the same baud rate, using an AT command.
oh looks like I forgot to mention, yes, it is ESP8266 01 type. I found WIFI101/wifinina firmware updater, I assume this is what you were talking about. I selected programming port and selected the default firmware it had selected (WINC 1501 Model B 19.6.1 Arduino/genuino MKR 1000. That isn’t my board but the Zero board is made by Genuino and there were no zero-firmwares available so i went with it. Same thing with domain, there was arduino.cc443 and nothing else so I went with it, tried to upload certificates to wifi module and i get an error: programmer not responding.
java.lang.Exception: Programmer not responding
Make sure that FirmwareUpdater sketch is loaded on the board.
at cc.arduino.plugins.wifi101.flashers.java.FlasherSerialClient.hello(FlasherSerialClient.java:108)
at cc.arduino.plugins.wifi101.flashers.java.WINCFlasher.updateFirmware(WINCFlasher.java:63)
at cc.arduino.plugins.wifi101.UpdaterImpl$2.run(UpdaterImpl.java:214)
java.lang.Exception: Programmer not responding
Make sure that FirmwareUpdater sketch is loaded on the board.
at cc.arduino.plugins.wifi101.flashers.java.FlasherSerialClient.hello(FlasherSerialClient.java:108)
at cc.arduino.plugins.wifi101.flashers.java.WINCFlasher.updateFirmware(WINCFlasher.java:63)
at cc.arduino.plugins.wifi101.UpdaterImpl$2.run(UpdaterImpl.java:214)
java.lang.Exception: Programmer not responding
Make sure that FirmwareUpdater sketch is loaded on the board.
at cc.arduino.plugins.wifi101.flashers.java.FlasherSerialClient.hello(FlasherSerialClient.java:108)
at cc.arduino.plugins.wifi101.flashers.java.WINCFlasher.uploadCertificates(WINCFlasher.java:114)
at cc.arduino.plugins.wifi101.UpdaterImpl$3.run(UpdaterImpl.java:280)
java.lang.Exception: Programmer not responding
Make sure that FirmwareUpdater sketch is loaded on the board.
at cc.arduino.plugins.wifi101.flashers.java.FlasherSerialClient.hello(FlasherSerialClient.java:108)
at cc.arduino.plugins.wifi101.flashers.java.WINCFlasher.uploadCertificates(WINCFlasher.java:114)
at cc.arduino.plugins.wifi101.UpdaterImpl$3.run(UpdaterImpl.java:280)
java.lang.Exception: Programmer not responding
Make sure that FirmwareUpdater sketch is loaded on the board.
at cc.arduino.plugins.wifi101.flashers.java.FlasherSerialClient.hello(FlasherSerialClient.java:108)
at cc.arduino.plugins.wifi101.flashers.java.WINCFlasher.uploadCertificates(WINCFlasher.java:114)
at cc.arduino.plugins.wifi101.UpdaterImpl$3.run(UpdaterImpl.java:280)
If it’s a factory firmware then do I even need to do anything about it? Isn’t it just automatic then?
OK so since I don’t have my ESP directly connected to the usb I should upload via Arduino Zero -board? ok got it. But what does that mean for my LCD then. Is it possible to read sensors, display them on an LCD and also upload them online at the same time possible?
What exactly is softwareserial? Isn’t it a library? I posted an error in another forum and I was told that Arduino Zero doesnt have softwareserial so I should be using Serial1 instead. But I would be happy to try Softwareserial. how do I exactly do it, can I have detailed instructions? (sorry I am a beginner when it comes to arduino and blynk). What changes do I need to make to the example codes?
example code for zero board and esp8266 wifi connection. I did as you said, I included softwareserial (the lines were ready to be used behind slashes so i just took them out). The result was error compiling for board
No, the ESP-01 needs to be running the factory AT firmware.
I have no idea why you are doing this, any firmware that this loaded to the board will be overwritten when you upload your Blynk sketch. It is the ESP-01 that needs to be running the default firmware, not the Arduino.
You are not uploading any code to the ESP-01, it will be running the default factort AT firmware only. The code is uploaded to the Arduino and the Arduino will use the ESPP-01 as a WiFi modem, via AT commands in the background.
Yes, you do thsi by writing the code for the Arduino.
SoftwareSerial creates a ‘virtual’ serial port. I thought the Zero only had one serial port, hence the need for an additional ‘virtual’ one. If it has two then use Serial for debugging and Serial1 for the ESP-01.
ok, so how do I do that, is it automatic? if it’s factory isnt it automatic?
because, as I said, I am a beginner when it comes to this, I have been trying to make this work for past three days and I am starting to get desperate. I don’t think it loaded anything since it error’d.
OK, I guess I understand.
Oh yes, forgot to mention. Uno and Zero are mostly similar but the main difference is in the ports. Zero has programming port which I have solely used for uploading code to my arduino, and then there is also native usb port, which purpose I don’t really know. It does power my arduino but I am using a cell battery for that.
I posted another reply where i uncommented the softwareserial commands in the example code, and that led into a compiling error. What do you mean by using serial for debugging and serial1 for esp-01? How do I achieve this? Sorry for asking something that you probably consider self-evident, as I said I am a beginner. You seem like an expert when it comes to arduino, I would be very grateful if you provided me with easier instructions to follow.
Best regards,
Kirill