Physical size of solar panel is 95mm by 95mm.
It's a 5V, 1 watt panel that we bought from Banggood in China.
The battery is a Li-Ion rated at 3.7V, 2500mAh (again from Banggood).
Couple of things to point out about our set-up...
We configured switches on D5 and D6 and an output on D7.
D5 defines whether to publish the sensor readings to ThingSpeak or not.
If D5 = 1, publish, if D5 = 0, don't publish
The system always publishes to Node-RED via MQTT, but can optionally also publish to ThingSpeak.
D6 defines whether the Wemos or Node-RED controls the deepsleep action.
If D6 = 1, Wemos invokes deepsleep, if D6 = 0, Node-RED controls it.
This is really useful as Node-RED can send an 'event command' to the Wemos to prevent it going back into 'deepsleep' when it wakes up.
We use it to enable us to log-in to the Wemos and make adjustments, then put it back to sleep.
D7 (output) drives the base of a Bipolar Junction Transisitor which in turn operates a MosFET.
This arrangement is used to turn the power (+3v3) on/off to the auxilary devices (in our case a BME280 which reads temp, humidity and pressure).
This is Rule-Set-1
Code: Select all
// Link D0 and RST for wake-up at the end of DeepSleep
//
// D5 is used to select whether to publish to ThingSpeak or not
// D5=1 (pulled-hi) Do-not publish to ThingSpeak
// D5=0 (grounded) Do publish to ThingSpeak
//
// D6 is used as an input to sense the operating mode
// D6=1 (pulled-hi) Wemos invokes DeepSleep
// D6=0 (grounded) Node-RED invokes DeepSleep
//
// D7 connects to the base of a BJT
// which in turn connects to the gate of a P-channel MOSFET to power the AUX devices
// Logic '0' turns BJT 'off'
// Logic '1' turns BJT 'on'
on MQTT#Connected do
TaskValueSet,1,3,0 //Set wemos#donotsleep=0
TaskValueSet,1,2,600 //Set wemos#fixedsleeptime to 15 minutes
gpio,13,1 //Set D7 to logic '1' to turn BJT 'on'
timerSet,1,6 //Delay for 6 secs to allow AUX devices to become active
//and take a couple of readings
endon
on Rules#Timer=1 do
event publishReadings //Rule Set 2
timerSet,2,3 // Allow 3 sec for Node-RED to send 'event,doNotSleep=1'
endon
on Rules#Timer=2 do
if [switch_d6#sw_d6]=1 and [wemos#donotsleep]=0
gpio,13,0 //Set D7 to logic '0' to turn BJT 'off'
timerSet,3,1 //1 second delay then go in to DeepSleep
endif
endon
on Rules#Timer=3 do
deepsleep,[wemos#fixedsleeptime]
endon
on Rules#Timer=4 do
deepsleep,[wemos#sleeptime]
endon
on SampleThenSleep do
TaskValueSet,1,1,%eventvalue1% //Set wemos#sleeptime from %eventvalue1%
event publishReadings //Rule Set 2
if [wemos#sleeptime]>0
timerSet,4,3 //Delay for 1sec then go in to DeepSleep
endif
endon
on doNotSleep do
TaskValueSet,1,3,%eventvalue1% //Set wemos#donotsleep from %eventvalue1%
endon
This is Rule-Set-2
Code: Select all
on publishReadings do
publish weatherStation/reading,{"node_type":"wemos_D1_min","ssid":"%ssid%","ip_address":"%ip%","wifi_strength":[sysinfo#strength],"solar_panel":[analog_3#a3],"lion_battery":[analog_2#a2],"supply_to_wemos":[analog_1#a1],"wemos_3v3_supply":[analog_0#a0],"temperature":[bme280#temperature],"humidity":[bme280#humidity],"pressure":[bme280#pressure]}
if [switch_d5#sw_d5]=1
SendToHTTP api.thingspeak.com,80,/update?api_key=<your_API_key_goes_here>&field1=[bme280#temperature]&field2=[bme280#humidity]&field3=[bme280#pressure]
SendToHTTP api.thingspeak.com,80,/update?api_key=<your_API_key_goes_here>&field1=[analog_3#a3]&field2=[analog_2#a2]&field3=[analog_1#a1]&field4=[analog_0#a0]
endif
endon
Here's a screenshot of the 'Devices' tab inside the Wemos.
At the moment we are using an ADS1115 (analog switch) to monitor and report the voltage of the solar panel, the voltage of the battery and the value of the +3V3 rail/pin.
We are also using a MQTT broker on the cloud (beebotte.com) as the student and I wanted to be able to monitor the readings at the weather station from home.
'SampleThenSleep' and 'doNotSleep' are event-commands sent from Node-RED to manipulate the operational mode of the Wemos.
Hope you can 'hack' the above around to suit your needs.
Let me know if you need any further information.
Regards, David.

- ScreenShot123.png (65.49 KiB) Viewed 36168 times