I have a project in progress that is the third generation of my Hen House Door project. I want to be able to open and close the door from my home automation controller (Raspberry Pi 2 running NodeRED). Unfortunately, the hen house is at the end of the garden and out of WiFi range. Anyway the door opener is low-power and solar powered, and WiFi uses too much current.
I've used NRF24 and CC1101 modules before and frankly there are a lot of wires to connect for SPI and generally a mess of libraries to try and get working. Wouldn't it be lovely (I mused) if there was a long range wireless module that talked UART serial and hid all the communication layer stuff.
With a bit of googling, I was delighted to find the HC-12 modules that do exactly that. They take AT commands to configure them for power mode etc. But aside from that they work just like you had a cable between your two devices and talked serial along it.
Eventually, my Raspberry Pi 2 will talk to the hen house controller that is based on an ATTiny1616 at 1MHz and using a minimal amount of electricity except when driving the door motor. But as a first test, I thought it would be good to establish a link between a Pico and a regular Raspberry Pi (in this case, my Pi 400).
The Pico
Here's the Pico end.
The connections are:
- GND on the Pico to GND on the HC-12
- 3V on the Pico to 3V on the HC-12
- Tx on the Pico to Rx on the HC-12
- Rx on the Pico to Tx on the HC-12
The Raspberry Pi
The connections are:
- GND on the Pi to GND on the HC-12
- 3V on the Pi to 3V on the HC-12
- Tx on the Pi (14) to Rx on the HC-12
- Rx on the Pi ( 15) to Tx on the HC-12
pi@pi400:~ $ nano hc_12.py
pi@pi400:~ $ python3 hc_12.py
1553
1554
1555
1556
1557
1558
No comments:
Post a Comment