Flow sensor controller firmware for Particle Photon and Electron hardware. Provides meter readings over serial port and Wifi (Photon) or cellular (Electron) network connections.
To build and flash your particle device, load the main.ino
file into the Particle IDE and flash it to your device. That's it!
The following pins are configured (all optional):
D1
- Flow metermeter0
D2
- Flow metermeter1
D3
- Flow metermeter2
D4
- Flow metermeter3
D5
- OneWire DS1820 temperature sensor.
Most flow meters, along with DS1820 temperature sensors, require a pull-up resistor for proper operation. Consult hardware documentation.
There are three ways to read meter data from the device:
- Serial interface: Connect directly to the serial port. This interface is always running.
- TCP interface: Connect to the device on a TCP port.
- Cloud interface: Publishes a message to the Particle cloud using Particle.publish(). This interface is active when no TCP clients are connected.
The firmware runs a TCP server on port 8321
where meter readings are
published. A single client at a time can connect to this port.
Example:
$ telnet 192.168.1.7 8321
info: kegboard-particle device_id=1234abcd1234abcd00001111 version=0.1.0
kb-status: meter0.ticks=0 meter1.ticks=0 meter2.ticks=0 meter3.ticks=0
kb-status: meter0.ticks=16 meter1.ticks=0 meter2.ticks=0 meter3.ticks=0
The device will broadcast the mDNS hostname kegboard
. On Mac OS X, you can typically locate the device with the hostname kegboard.local
rather than by IP:
$ telnet kegboard.local 8321
Trying 192.168.86.100...
Connected to kegboard.local.
Escape character is '^]'.
info: kegboard-particle device_id=3f0000000000000000000001 version=0.1.0
Meter updates are also published on the serial port, in the same message format as the TCP server.
If there is no TCP client connected, the device will instead report status, up to once a second, to the Particle Cloud.
Log in to the Particle logs console to see events.
Offered free and open source under the MIT license. See LICENSE.txt
.