
PumpMonitor
jgOhYeah/Farm-PJON-LoRa-network
Code relating to a small LoRa network for remote monitoring and control

Code relating to a small LoRa network for remote monitoring and control
ElectricFenceMonitor 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 83.8 × 33.7 mm with 30 parts on 23 nets, routed with 84 tracks and 28 vias.
It is built around the BC548. Its parts include 11 resistors, 8 diodes, 5 capacitors, 3 connectors and 2 ICs. It belongs with the radio and wireless boards of this library.
Code relating to a small LoRa network for remote monitoring and control. This is a work in progress.
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.
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.
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.
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.
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 :).

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

The shed and setup of the battery 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.
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.
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.

Bird's eye view of the circuit.

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

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 box.
| Qty | Value | Footprint | References |
|---|---|---|---|
| 2 | 1N4148 | Diode_THT:D_DO-35_SOD27_P5.08mm_Vertical_KathodeUp | D2, D8 |
| 2 | 1N4148 | Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal | D4, D7 |
| 1 | 0.1u | Capacitor_THT:C_Rect_L9.0mm_W2.5mm_P7.50mm_MKT | C1 |
| 1 | 0.1u | Capacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mm | C2 |
| 1 | 0.47u | Capacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mm | C3 |
| 1 | 100u | Capacitor_THT:CP_Radial_D13.0mm_P5.00mm | C5 |
| 1 | 10Meg | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P5.08mm_Vertical | R11 |
| 1 | 10k | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P2.54mm_Vertical | R6 |
| 1 | 10u | Capacitor_THT:CP_Radial_D13.0mm_P5.00mm | C4 |
| 1 | 120 | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P2.54mm_Vertical | R4 |
| 1 | 120k | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P2.54mm_Vertical | R7 |
| 1 | 180 | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal | R12 |
| 1 | 1N4148 | Diode_THT:D_DO-35_SOD27_P12.70mm_Horizontal | D3 |
| 1 | 1N4148 | Diode_THT:D_DO-35_SOD27_P10.16mm_Horizontal | D1 |
| 1 | 1k | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal | R14 |
| 1 | 2.2k | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal | R13 |
| 1 | 220 | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal | R9 |
| 1 | 22k | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P5.08mm_Vertical | R5 |
| 1 | 33k | Resistor_THT:R_Axial_DIN0309_L9.0mm_D3.2mm_P12.70mm_Horizontal | R10 |
| 1 | 5.1V | Diode_THT:D_A-405_P10.16mm_Horizontal | D5 |
| 1 | 82k | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R8 |
| 1 | BC548 | Package_TO_SOT_THT:TO-92_Inline_Wide | Q1 |
| 1 | Fence | TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2-5.08_1x02_P5.08mm_Horizontal | J1 |
| 1 | LED | LED_THT:LED_D5.0mm | D6 |
| 1 | PICAXE-14M2 | Package_DIP:DIP-14_W7.62mm_Socket_LongPads | U2 |
| 1 | Power | TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2-5.08_1x02_P5.08mm_Horizontal | J3 |
| 1 | Programming | Connector_Molex:Molex_KK-254_AE-6410-03A_1x03_P2.54mm_Vertical | J2 |
| 1 | Ra01_Breakout_Module | Package_DIP:DIP-8_W7.62mm_Socket_LongPads | U1 |

jgOhYeah/Farm-PJON-LoRa-network
Code relating to a small LoRa network for remote monitoring and control

jgOhYeah/Farm-PJON-LoRa-network
Code relating to a small LoRa network for remote monitoring and control

jgOhYeah/Farm-PJON-LoRa-network
Code relating to a small LoRa network for remote monitoring and control

jgOhYeah/Farm-PJON-LoRa-network
Code relating to a small LoRa network for remote monitoring and control

ExploreEmbedded/8051_DevelopmentBoard
Design files and sample code for 8051 development Ultra Boards



DarcyJProjects/touchtone555
An open-source DIY, NE555-based analogue synthesizer - play notes with a stylus


clemarfolly/Microdigital-TK2000
Reprodução da PCB do TK-2000 da Microdigital, clone do Micro-Professor MPF-II

Danjovic/Soda-IDE
8 bit Compact Flash Interface for MSX computers

alvaroalea/all-spectrum-clones
Schematic of a 8bit computer, clone of Sinclair ZX Spectrum
It measures 83.8 × 33.7 mm and has 2 copper layers, 1.6 mm thick.
30 parts, built around the BC548. 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.
From the jgOhYeah/Farm-PJON-LoRa-network repository on GitHub, at the commit this page was made from: the board is ElectricFenceMonitor/ElectricFenceMonitor/ElectricFenceMonitor.kicad_pcb and its schematic BatteryVoltageMonitor/BatteryMonitorVeroboardLayout/BatteryMonitorVeroboardLayout.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
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).