Hi,
I am new to Blynk but have managed to get my first project running (well for a while anyway). I am using an ESP32 which is reading data from a DH22 temperature and humidity sensor and RTC, then displaying it to an LCD display. The Micropython code has been running well until I connected it to Blynk which now causes the following error and stops the code: - (Code runs for intermittent periods before coming up with this error 1 - 4 hours)
rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:5008
ho 0 tail 12 room 4
load:0x40078000,len:11608
ho 0 tail 12 room 4
load:0x40080400,len:6120
entry 0x400806bc
W (65) boot: PRO CPU has been reset by WDT.
W (65) boot: WDT reset info: PRO CPU PC=0x400983ab
W (65) boot: WDT reset info: APP CPU PC=0x400945a6
E (647) spiram: SPI RAM enabled but initialization failed. Bailing out.
E (391) spiram: SPI RAM not initialized
MicroPython v1.14 on 2021-02-02; ESP32 module (spiram) with ESP32
import dht
import machine
import time
import network
from ds1307 import DS1307
from machine import I2C, Pin
from lcd_driver import I2cLcd
import BlynkLibESP32 as BlynkLib
import _thread as thread
# Setup LCD I2C driver
LCD_DEFAULT_I2C_ADDR = 0x27 # Address for LCD display
lcd_i2c = I2C(scl=Pin(23), sda=Pin(22), freq=400000)
lcd = I2cLcd(lcd_i2c, LCD_DEFAULT_I2C_ADDR, 2, 16) # Object for LCD
# Create sensor object
dht22 = dht.DHT22(machine.Pin(16))
# Create RTC obect
RTC_DEFAULT_I2C_ADDR = 0x68 # Address for RTC module
rtc_i2c = I2C(scl=Pin(23), sda=Pin(22), freq=400000)
rtc = DS1307(rtc_i2c, RTC_DEFAULT_I2C_ADDR) # Object for RTC
# Function to setup / display and check wifi connection - returns "FAILED" or "SUCCESS")
wifi = network.WLAN(network.STA_IF) # WLAN setup as station
wifi.active(True) # Turn wifi ON
wifi.connect("*******", "********") # Connect to router
wifi_test = wifi.isconnected() # Check wifi is connected
# Blynk token
blynk = BlynkLib.Blynk("*************")
while True:
if wifi_test == False:
time.sleep(1)
wifi_test = wifi.isconnected
print("Trying to connect to WIFI")
else:
print ("SUCCESS")
break
# Fuction to keep display updated
def update_display(none):
while True:
timeno = rtc.datetime()
lcd.move_to(0,1)
lcd.putstr(str(timeno[4]) + ":" + str(timeno[5]))
dht22.measure()
temperature = round(float(dht22.temperature()),0)
temperature = str(temperature)
humidity = round(float(dht22.humidity()),0)
humidity = str(humidity)
lcd.move_to(0,0)
lcd.putstr("TP=" +temperature + " " + "%RH=" + humidity)
time.sleep(1)
#blynk.virtual_write(2, 0)
time.sleep(1)
#print(temperature + '-----' + humidity)
blynk.virtual_write(0, temperature)
blynk.virtual_write(1, humidity)
blynk.virtual_write(2, 255)
thread.start_new_thread(update_display, (None,))
while True:
blynk.run()
Any help would be appreciated
Dave