Implement a secure ICS protocol targeting LoRa Node151 microcontroller for controlling irrigation.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 
John-Mark Gurney 62ddf5d243 start implementing the core part of the irrigation controller... před 3 roky
loramac add pin description, and use the analog pin to provide randomness.. před 3 roky
stm32 add support for saving PRNG state to EEPROM... před 3 roky
strobe add the start of the C version for the uC... před 3 roky
.gitignore add recommended build dir to be ignored.. před 3 roky
LICENSE.txt talk about the special ST license.. před 3 roky
Makefile start implementing the core part of the irrigation controller... před 3 roky
NOTES.md add notes about unix dgrams.. před 3 roky
PROTOCOL.md add support for replying last message if it was lost.. před 3 roky
README.md explain a bit why Lorawan wasn't used, and clarify compiler issue.. před 3 roky
board-config.h get tx/rx working between two Node151's.. před 3 roky
board.c missed setting up routing for the analog pin.. před 3 roky
comms.c make sure that comms.c enforces handshake messages.. před 3 roky
comms.h add support for starting a new session... před 3 roky
irr_main.c start implementing the core part of the irrigation controller... před 3 roky
lora.py add setunset command to set the state of a channel.. useful for testing.. před 3 roky
lora_comms.py support importing this w/o the lib... před 3 roky
loraserv.py make sure we don't buffer the serial port, we need the packets to před 3 roky
main.c make sure we filp back to rx after we're done tx'ing... před 3 roky
misc.c add copyright statement to various files as needed.. před 3 roky
misc.h get tx/rx working between two Node151's.. před 3 roky
multicast.py break out some util functions, implement multicast adapter for LORANode... před 3 roky
requirements.txt add the required python packages.. před 3 roky
strobe_rng_init.c add support for saving PRNG state to EEPROM... před 3 roky
strobe_rng_init.h add support for saving PRNG state to EEPROM... před 3 roky
sysIrqHandlers.h get tx/rx working between two Node151's.. před 3 roky
util.py forgot to add the copyright for this file.. před 3 roky
util_load.py change the default to be func.. před 3 roky

README.md

LoRa Irrigation System

This project is to build an irrigation system from LoRa capable microcontrollers. The Heltec Node151 was chosen due to it’s small size and inexpensive cost.

Design Decisions

While investigating this, the LoraWAN protocol was investigated, but after looking at the code complexity and other operational requirements, if was decided that for this project, it was safer to target a direct Node to Node style communication system. This would allow the implementation to be more simple, and security to be built in (LoRaWAN does have a crypto layer, BUT, trusting/auditing it and any library that implements it would be a larger task than I want to undertake). It could also be used for other projects that need security.

One of the other requirements is that the code be 100% open sourced, not GPL licensed, and no proprietary components. This meant that using IDE’s like ST’s STM32CubeIDE which is only available in binary form was not a choice, as that would preclude building on an operating system other than Windows/MaxOS/Linux.

Building

The build system uses the BSD flavor of make. This is the default make on the BSDs, originally called pmake, but also available as bsdmake for MacOSX, and likely other operating systems as well.

It also depends upon ARM’s GNU Arm Embedded Toolchain, which uses gcc as the compiler. It would be good to get it cross-compile with clang as well, but that requires finding a libc like the nano libc that is provided by the toolchain.

Once ARM’s toolchain is in your path, the following should work:

export MAKEOBJDIR=build
mkdir $MAKEOBJDIR
bsdmake all

And in the directory build, a file lora.irr.elf should be present.

Flashing

Flashing can be done via the open source tool OpenOCD. For this, I use a Digilent HS1 JTAG programmer utilizing the resistor hack to allow an FTDI JTAG programmer to control the bi-directional SWIO pin.

One caveat w/ MacOSX, is that it may be necessary to unload the kext com.apple.driver.AppleUSBFTDI via the command:

sudo kextunload -b com.apple.driver.AppleUSBFTDI

as OpenOCD wants direct access to the FTDI driver.

Once that happens, the device can be programmed using the following command:

sudo openocd -f interface/ftdi/digilent-hs1.cfg -f interface/ftdi/swd-resistor-hack.cfg -f target/stm32l1.cfg -c "init" -c "reset init" -c "program build/lora.irr.elf verify reset exit"

Pins

The pinout guide for the Node151.

The pins PB5-7,9 are used as active low controls for the relays.

The pin PB15 is used as an analog input for an RNG source. This pin should be grounded.