mqtt mcp simulator

Pierre Fromager 37ce15fbbf doc : README 2 years ago
.vscode f3a25573d8 init repo 2 years ago
doc 8eaab14f61 clean : remove useless files 2 years ago
fixtures f3a25573d8 init repo 2 years ago
src cb81950d11 clean : remove useless files 2 years ago
.gitignore cb81950d11 clean : remove useless files 2 years ago
Makefile f3a25573d8 init repo 2 years ago
README.md 37ce15fbbf doc : README 2 years ago

README.md

Mqttmcp

Mqttmcp is a simulator to control MCP23017 output using mqtt through a word state.
Portage to arduino or such platform is easy, just copy paste.
I did portage to esp32 with extensa toolchain and it rocks without changing anything.

Build

make

Clean

make clean

Doc

make doc

Doc in doc/html folder.

Usage

./mqttmcp 

MCP23017

Datasheet

Mqtt

There is no C implementation of the mosquitto client in this source.
But there are some bash fixtures to pub sub in fixtures/bash folder.
Install the mosquitto client first :

sudo apt install mosquitto-clients

Edit and change config according to your broker settings.

Esp32

I use to play with esp32 and esp-idf framework.
To init the mcp I used esp32-mcp23017.
To write the x2 8 bits registers simply use :

mcp23017_write_register (&mcp, MCP23017_GPIO, GPIOA, (uint8_t) value);
mcp23017_write_register (&mcp, MCP23017_GPIO, GPIOB, (uint8_t) value);

Breadboard

Breadboard

Do not forget to pull down reset pin to VCC with 10k resistor.
In some cases, pull up i2c bus is required on sda scl lines uses 4.7k resistors for each.