Sense/Control/Report project

Just been trying out some ideas for a new project for my IoT students. It's based on the weather-station project the students tackled a couple of years ago - but this time more generic or general-purpose and using the latest Pico-H & Pico-WH devices and Micro-Python.

Here's a block-diagram of the ideas I have for the project (so far).


Remote Station
Each remote station (there can be up to six) can be fitted with various 'devices' - for example a temp/humdity/pressure sensor, a set LEDs, a set of relays, servo motors as well as PWM outputs. Each remote station will use a Pico-H and can operate in 'passive' mode - where it just waits until it receives a request (more details below), or it can be in 'active' mode - where it sends information at regular intervals.

I'm planning on using the long-range version of the NRF24 radios (with a range of 2500m) as the school (my IoT students attend) has a large expanse of grounds and playing fields.
NRF24
The radios can handle a max packet size of up 32-bytes. I'm intending to use a fixed packet of 32-bytes.

Base Station
When I started thinking about this project (earlier this year) I was planning on using my Combo PCB board as the base station. This board uses an ESP-01S to give a Pico-H WiFi capability.


Technology has overtaken me... so I'll now be using a Pico-WH in the base station.

Command structure
Here's one of my world famous 'rough' sketches for the proposed command structure.

The 'nodeID' is a two-character field used to define which remote station should response to the 'cmd'. Each 'cmd' is five characters in length padded with 'dots' or something. So taking the command 'temph' as an example the structure would be... nodeID, cmd, value e.g. . 'D1', 'temph', 0
When this command arrives at a remote station the 'node'ID' is checked to see if it matches that node. If it does - then the remote station gets the T/H/P reading and sends to the base station with this format...
'nodeID', 'cmd', 'temp', 'humidity, 'pressure' e.g. 'D1', 'temph', 26.5, 62, 1002

Node-RED
I'm planning on using the MQTT features of Node-RED to send each type of command and decode the information returned from a remote station.

Here are a couple of examples.
Project_idea_temph
Project_idea_leds

Here's an example of data being received from remote station D1.
Project_idea_data

Battery and/or solar panel opeartion
One enhancement I've explored is running a remote station off of a battery and putting it to sleep to save energy. The only problem with that idea is... the Pico doesn't seem to support Deep-Sleep. So I've tested using an ATtiny as a power-manager for the Pico. Using the serial bus the Pico and ATtiny can communicate with each other and execute some of the commands (listed above) namely... 'time', 'sleep' and 'boot'. So if the command 'time', 300 was sent to a remote station, the Pico would pass this value to a register inside the ATtiny, then when the command 'sleep' is sent it will turn power off to the Pico (using a MOSfet power transistor) before the ATtiny goes into 'snore' mode (for 300 seconds). As the ATtiny takes less than 4uA when it is snoring the battery-charge should last quite a long time.

Summary
I feel this should be an exciting project for my IoT students as...

  • It uses Raspberry Pi Pico devices (bit more modern than Wemos D1 Mini)
  • It will be written using Micro-Python (one of the languages taught in the school)
  • It is modular - so groups of students can tackle different parts of the project
  • There are many spins-offs for learning other things like packing/unpacking data structures (e.g. struct.pack, struct.unpack), communication protocols, system design - as well as having a lot of fun.
4 Likes

Wow, that looks great @dynamicdave.