Then, define the pins used by your LoRa module. It starts by including the needed libraries. The sync word assures you don't get LoRa messages from other LoRa transceivers Change sync word (0xF3) to match the receiver replace the LoRa.begin(-E-) argument with your location's frequency define the pins used by the transceiver module Modified from the examples of the Arduino LoRa library It sends a “hello” followed by a number that is incremented in every message. It transmits messages every 10 seconds using LoRa. This sketch is based on an example from the LoRa library. In the next few weeks I plan to publish the Arduino sketch and work on the updated PCB.Open your Arduino IDE and copy the following code. The prototype module is now transmitting the internal RFM69 temperature data to another module attached to the Raspberry Pi and running the MySensors gateway. Note that the MySensors radio packets include two additional bytes in the packet header for the packet “version” and the “sequence number”. Here are the changes necessary to the RFM69 library for it to talk to the MySensors on Raspberry Pi. At first the MySensors gateway on Raspberry Pi wouldn’t pick up any radio transmission from the ATTiny841 sensor so I spent hours finding differences in the register setup for MySensors and the RFM69 library. There are dozens of ways to configure the RFM69 radio so it is important that both the transmitter and receiver use the same data encoding and encryption. An important thing to note is that ATTin圜ore only supports pin PB1 of ATTiny841 as the Arduino external interrupt pin so D100 on RFM69 must be connected to PB1 for it to initialize the radio and register the incoming data. Using the ATTin圜ore Arduino core from Spence Konde and the RFM69 library from Felix Rusu I was able to successfully communicate with the RFM69CW radio. Cutting the reset line to the radio fixed the issue ?. Turns out the reset pins of both ATTiny841 and RFM69CW were connected which caused the radio module to toggle the MISO and MOSI lines and interfere with the programming. The next step was to get the ATTiny841 talking to the RFM69CW radio and that took me days because it would just fail uploading the firmware as soon as I soldered the radio to the PCB. It was a nice surprise when the MySensors gateway on Raspberry Pi could detect the RFM69CW radio module right away. Here is the very first prototype PCB with just the required wiring (and no passives) for connecting the radio module to both the Raspberry Pi and the ATTiny841 microcontroller via the SPI bus:įirst prototype of the sensor module with RFM69CW radio connected to both ATTiny841 and Raspberry Pi via SPI So I designed a single device that could be used both as a standalone sensor/switch transmitter and as a receiver when attached to the Raspberry Pi. It supports all of the popular wireless radios such as RFM69, NRF24L01+ and ESP8266 attached to most of the popular microcontrollers such as Atmel AVR, STM32 and the BCM in Raspberry Pi. The MySensors project provides software libraries for sensors and gateways that integrate well with the Home Assistant automation platform which in turn works with the Apple Home. The actual switching would happen through relays in the home electricity distribution board. I want to design a wireless light switch that works for years without charging and doesn’t require mains connection and provides complete flexibility over the set of devices it controls.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |