Skip to the content
2 layers113 × 44.5 mmGateMonitorLayout, the printed circuit board in 3D

Code relating to a small LoRa network for remote monitoring and control

Size
113 × 44.5 mm
Copper layers
2
Thickness
1.6 mm
Parts
27
Nets
28
Pads
89
Tracks, vias
140, 48
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
27 Jan 2021
Updated
4 Jan 2025

Overview

GateMonitorLayout is an open-source printed circuit board by jgOhYeah, from the jgOhYeah/Farm-PJON-LoRa-network repository on GitHub, published under the MIT licence. It is a 2-layer board of 113 × 44.5 mm with 27 parts on 28 nets, routed with 140 tracks and 48 vias.

It is built around the IRLB8721PBF. Its parts include 11 resistors, 5 connectors, 4 capacitors, 3 ICs and 3 diodes. It belongs with the radio and wireless boards of this library.

Main components

1

README

README.md

Farm-PJON-LoRa-network

Code relating to a small LoRa network for remote monitoring and control. This is a work in progress.

Table of contents

Base stations

Arduino Nano base station

Currently an Arduino Nano and 40x2 Alphanumeric LCD, thinking of swapping the nano with a raspberry pi to allow better data logging and display over an ip network. This is still a work in progress. Needs the lcd graph library I have written to draw graphs on alpha numeric lcds. It is also a work in progress. This can be found here.

Raspberry Pi base station

Currently a work in progress and have not uploaded the files to Github yet, but uses a python script to interface with an SX1278 LoRa module and translate this into MQTT to pass to a Thingsboard server running on the pi.

This branch of the PyLora library is required to talk to the radio module as it has been adapted for python 3.

Battery voltage monitor and electric fence control

This is code currently in use in a device that is monitoring battery charge in a remote solar powered electric fence. It sends a packet with the battery voltage once every few minutes and listens for an incoming packet for a set time after each tansmission. The incoming packet can tell the device to turn the fence on or off or control other aspects of the radio link such as disabling transmissions until another incoming packet enables them or requesting the current status be resent.

Stripboard plans and schematic

I used KiCad to plan a layout on veroboard so that I knew there was room for everything and I didn't end up cutting the wrong tracks. The yellow circles and lines in layer Eco2.User are where tracks should be cut. The KiCad files can be found here. Battery Voltage Monitor Schematic Planned layout on stripboard

Photos

This is a work in progess and as such it is only temperarily mounted in the shed, although you know what they say about temporary things :). Circuit on stripboard in a plastic box

Battery voltage monitor before the mosfet was added for controlling the fence and an external antenna to improve range.

Inside of a shed with fence energiser, battery and monitor

The shed and setup of the battery monitor.

Pressure Pump Monitor

This is a monitor for the main pressure pump of the farm that allows the on time of the pump to be measured to hopefully detect leaks sooner rather than later.

The monitor currently operates by timing how many half seconds the pump is on in a half hour block. At the end of each block, the monitor saves the time to a circular buffer stored in an EEPROM chip, calculates the average on time for all values in the chip and transmits the time on in the last half hour as well as the average on time as a LoRa radio packet using the PJON protocol for addressing.

To detect when the pump is running, a simple current transformer was made by winding the neutral wire in a mains extension lead around a filtering choke from an old power supply. Some electrical spaghetti insulation was placed over the neutral wire to ensure that there are multiple layers of insulation between the primary coil formed by the neutral wire and the secondary coil formed by the ~100 turns of enamal copper wire originally on the choke. This is amplified and rectified by a pair of transistors on the pump monitor circuit board. The current transformer is not particulary linear and the amplifier was designed to output a digital signal, meaning that precise current measurement is not currently an option :). Having said that, the system does seem to be quite reliable in detecting when the pump is on and off.

Using an XL2416CP 16kb EEPROM chip, approximately 20 days worth, or 1023 values can be stored at a time.

Compiling and software upload

The software to handle the circular buffer and talk to the radio module take up most of the program space. Strings to print using sertxd are stored in table memory. To avoid having to calculate string lengths and memory locations, I have been working on an extension to this python preprocessor, currently in this branch that will automatically add and call the correct subroutines whenever a ;#sertxd directive is encountered. If you don't want to use this, you can use the compiled.bas file that will have and the ;#sertxd directives correctly substituted, or use the standard PICAXE Programming Editor 6 that will ignore them as a comment, leaving code that will work, but with cryptic numbers being all that is printed to the serial console.

Stripboard plans and schematics

As with the Battery monitor above, I planned out a layout using Kicad before printing a template and using this to cut tracks and place jumper wires and components in the required places. The Kicad files can be found here. Pump monitor schematic Pump monitor off board wiring Pump monitor veroboard layout

Photos

Circuit on stripboard

Bird's eye view of the circuit.

Circuit showing placement of LEDs

View of the monitor circuit board showing the placement of the indicator LEDs.

Testing, showing the pump and current transformer

Testing and software development showing the pump and current transformer (inside the green and black poly pipe extension of a mains socket).

The pump monitor in its black plastic box with hand drawn labels

The pump monitor in its box.

Future Changes

  • At the moment, there is no alarm detection, but when I get around to it, I will probably implement it as part of this device to avoid issues caused by the radio link not being completely reliable. It would probably establish a baseline on time where all the pump is doing is running for a few seconds every hour to keep pressure up and raise an alarm if the pump is over this for X consecutive blocks of time (i.e. water is being used for an unexpectedly long time or there is a leak). In this way, it would hopefully be fairly sensitive to moderate and high leaks over a few hours, but not raise too many false alarms from watering the gardens and fruit trees.
  • Another thing to do is to rewrite the timing code to use interrupts to detect when the pump has started and stopped to avoid the current situation where the pump is not counted as running even if it is during long operations such as calculating the average times.
  • I recently found out that the 18m2+ chips have support for multiple slots, so it might be useful to put an eeprom debugging program in slot1 that can be called under a specific set of conditions to save having to reflash the chip and alternate between software whenever debugging needs to be done.

Parts

27
QtyValueFootprintReferences
21N4004Diode_THT:D_DO-41_SOD81_P5.08mm_Vertical_AnodeUpD1, D2
1100nCapacitor_THT:C_Axial_L3.8mm_D2.6mm_P12.50mm_HorizontalC4
1100pFCapacitor_THT:C_Disc_D7.0mm_W2.5mm_P5.00mmC2
1100uCapacitor_THT:C_Rect_L13.0mm_W6.0mm_P10.00mm_FKS3_FKP3_MKS4C1
110kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR1
122kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P5.08mm_VerticalR2
1270kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR4
13.3uCapacitor_THT:CP_Radial_D8.0mm_P5.00mmC3
133kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P5.08mm_VerticalR6
14.7kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR11
14.7kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR9
14.7kResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P2.54mm_VerticalR7
14.7kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P5.08mm_VerticalR8
1470Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR5
1470kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P5.08mm_VerticalR3
1AHT20 temperature sensorConnector_PinSocket_2.54mm:PinSocket_1x04_P2.54mm_VerticalJ4
1Conn_01x03Connector_Molex:Molex_KK-254_AE-6410-03A_1x03_P2.54mm_VerticalJ2
1Hall effectTerminalBlock:TerminalBlock_Altech_AK300-3_P5.00mmJ5
1IRLB8721PBFPackage_TO_SOT_THT:TO-220-3_VerticalQ1
1LDR07OptoDevice:R_LDR_7x6mm_P5.1mm_VerticalR10
1LEDLED_THT:LED_D5.0mmD3
1MIC2954Package_DIP:DIP-8_W7.62mm_Socket_LongPadsU3
1PICAXE-18M2Package_DIP:DIP-18_W7.62mm_Socket_LongPadsU2
1PIR sensorConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ3
1Ra01_Breakout_ModulePackage_DIP:DIP-8_W7.62mm_Socket_LongPadsU1
1Screw_Terminal_01x03TerminalBlock:TerminalBlock_Altech_AK300-3_P5.00mmJ1

More from jgOhYeah/Farm-PJON-LoRa-network

4
  • 2 layers83.8 × 33.7 mmElectricFenceMonitor, the printed circuit board in 3D

    ElectricFenceMonitor

    jgOhYeah/Farm-PJON-LoRa-network

    Code relating to a small LoRa network for remote monitoring and control

    30 parts1MIT
  • 2 layers119.4 × 55.9 mmPumpMonitor, the printed circuit board in 3D

    PumpMonitor

    jgOhYeah/Farm-PJON-LoRa-network

    Code relating to a small LoRa network for remote monitoring and control

    30 parts1MIT
  • 2 layers100 × 50 mmBatteryMonitorVeroboardLayout, the printed circuit board in 3D

    BatteryMonitorVeroboardLayout

    jgOhYeah/Farm-PJON-LoRa-network

    Code relating to a small LoRa network for remote monitoring and control

    23 parts1MIT
  • 2 layers61 × 33 mmWaterbabyLayout, the printed circuit board in 3D

    WaterbabyLayout

    jgOhYeah/Farm-PJON-LoRa-network

    Code relating to a small LoRa network for remote monitoring and control

    13 parts1MIT

Similar boards

  • 2 layers50.8 × 28.6 mmBeaglebone obd, the printed circuit board in 3D

    Beaglebone obd

    KoffeinFlummi/rustbucket

    Access your car's diagnostics with a BeagleBone Blue and Rust.

    20 parts60GPL-3.0
  • 2 layers99.1 × 99.1 mm3D Scanner, the printed circuit board in 3D

    3D Scanner

    nazzrim/Open3DScanner

    Open3DScanner 3D Scanner design

    33 parts60
  • 2 layers36 × 31 mmESPDimmer, the printed circuit board in 3D

    ESPDimmer

    stelioskat/esp8266-led-dimmer

    Wifi enabled LED strip dimmer that is controlled using MQTT messages.

    11 parts20MIT
  • 2 layers70.3 × 30.2 mmControl pcb, the printed circuit board in 3D

    Control pcb

    kbob/filabilly-humidor

    Dehumidifier cabinet for printer filament

    16 parts9
  • 4 layers104.2 × 77.7 mmDc26, the printed circuit board in 3D

    Dc26

    dodgymike/dc26-monero-badge-pcb

    Defcon 26 Monero badge PCB

    714 parts6
  • 4 layers69.9 × 44.5 mmDoughLee2, the printed circuit board in 3D

    DoughLee2

    chl33/Dough133

    A temperature-controlled container for proofing and fermenting soughdough

    62 parts3MIT
  • 2 layers61 × 78.7 mmESP RGB LED, the printed circuit board in 3D

    ESP RGB LED

    Sean-AP/ESP-RGB-LED

    MicroPython module for controlling an RGB LED strip

    10 parts2
  • 2 layers33.8 × 49.5 mmEspAtomizerpcbv3rev1, the printed circuit board in 3D

    EspAtomizerpcbv3rev1

    Adamibus/ESPAtomizer-iOS

    This is a minimal KiCad 6/7 project skeleton. Open ESPAtomizer.kicadpro in KiCad.

    21 parts1

Questions

How big is the GateMonitorLayout PCB?

It measures 113 × 44.5 mm and has 2 copper layers, 1.6 mm thick.

What parts does the GateMonitorLayout use?

27 parts, built around the IRLB8721PBF. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the GateMonitorLayout KiCad files?

From the jgOhYeah/Farm-PJON-LoRa-network repository on GitHub, at the commit this page was made from: the board is GateMonitor/GateMonitorLayout/GateMonitorLayout.kicad_pcb and its schematic BatteryVoltageMonitor/BatteryMonitorVeroboardLayout/BatteryMonitorVeroboardLayout.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the GateMonitorLayout design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).