## ina260-zmq-publisher

A ZeroMQ-based power monitoring publisher for the ina260 chip.\
This repository provides:
- `publisher`: that collects power measurements from the ina260 using the dedicated driver with a thread that continuously publish the power measurements data using the ZeroMQ pub/sub communication pattern
- `subscriber`: a program that collects the measurements published by the publishers (used to create a broker, frontend etc...)

*Note: Nothing is stored locally! Everything that is published by the publishers is either received by the subscriber or lost.*

### Compilation
The only dependency is [ZeroMQ](https://zeromq.org/). After installing the ZeroMQ library, running `$ make` will generate all the executables.

### Deployment
1. Update `config.mk` according to your needs \*\***IMPORTANT**\*\*
2. On the nodes equiped with the ina260 chips and its driver, run `make publish`
3. On the node that collect the measurements (broker, frontend etc..) run `make subscribe`

### Notes
- Message format used in ZeroMQ exchanges:

    L1: <ZMQ_TOKEN>\
    L2: <KEY>\
    L3: <CLIENT>\
    L4: <INTERVAL>\
    L5-n: <CSV-DATA>