briglx / trykle

Water management controler
MIT License
0 stars 0 forks source link

trykle

Water management controler

Create a local conf.h based off of conf-example.h

Setup

Install PubSub Client

On arduino ide, goto tools -> Library Search for pubsub Installed v2.8

Configure MQTT Broker

Create a user and ACL for the user

Type Pattern Read Write
Topic user - # true /true

Docker image

docker build --pull --rm -f "dockerfile" -t trykle:latest "."
docker run -it --rm trykle:latest
#  docker run -it --privileged -v /dev:/dev --rm trykle:latest
#  docker run -it --privileged -v /dev/bus/usb:/dev/bus/usb --rm trykle:latest

docker run -it --privileged --device="class/DCDE6AF9-6610-4285-828F-CAAF78C424CC" --rm trykle:latest

Arduino CLI

arduino-cli core install esp8266:esp8266
arduino-cli core list
arduino-cli compile --fqbn arduino:esp8266:esp8266 MyFirstSketch

OpenSprinkler Analysis

Main loop code

Real Time Clock

The Real time clock runs on the I2C protocol

The device address is 0x68

There are 13 registers

Real Time Clock Ic^2 signal

To read, it looks like you have to write the device address and the regsiter address, then read

The data is coded in binary-coded decimal (BCD)

MCP23008-e/p PDIP/SOIC

Device Address Based on teh A0-1 pins

A0 | A1 | A2 | Decimal | Address

0 | 0 | 0 | 0 | 0x20 0 | 0 | 1 | 1 | 0x21 0 | 1 | 0 | 2 | 0x22 0 | 1 | 1 | 3 | 0x23 1 | 0 | 0 | 4 | 0x24 1 | 0 | 1 | 5 | 0x25 1 | 1 | 0 | 6 | 0x26 1 | 1 | 1 | 7 | 0x27

Register Address

Address Access to
00h IODIR
01h IPOL
02h GPINTEN
03h DEFVAL
04h INTCON
05h IOCON
06h GPPU
07h INTF
08h INTCAP (Read-only)
09h GPIO
0Ah OLA

Opensprinkler code:

References