I2C with MQTT MangOH Yellow

Hi,
Is it possible to get data from a I2C sensor and publish this to a broker? Is it necessary to use Airvantage? Or can you just send data to a broker?

If it is possible how can i do it? I’m using the IoT card for I2C.

No, it does not need to use Airvantage.
You can try the MQTT sample here:

Previously someone makes it work on mosquitto server.

Thanks for your reply.
How can i install the mqtt sample application. Can i do it in the ssh from the MangOH?
afbeelding

you need to compile it in “leaf shell”.

You can first install the VSCODE with LEAF plugin:

https://docs.legato.io/latest/tools_vsCode.html

I installed LEAF. But how can i install mqtt. I am totally unfamiliar with leaf. I also want data from a i2c sensor is that the same proces?

Did you try to read data via i2c with your hardware?

Maybe you also need to install vscode.

Here has the instruction on how to compile

No, i didn’t know how to do it. I never worked with VSCODE and LEAP. Do i need to make a program and then compile?

You need to have at least a linux driver, right?

Yes, I have :slight_smile: I also have VSCODE.

if your driver works, you should be able to read the required value in command line.
For example, in mangoh red project, if we run the pressure sensor driver correctly, we can see the value in /sys/bus/i2c/devices/4-0076/iio:device1/in_pressure_input.

After that you can import the value in .cdef, here is an example where we read the sensor in mangoh red board and send to the Airvantage:

You need to code everything? That’s possible in VSCode? And with that data from the sensor you can publish with mqtt? Sorry for that many questions. I don’t get it al all.

did you driver work now?

I don’t know what you mean. What do you mean by “driver”?

didn’t you have new hardware on the IoT card which is using I2C?

My question is, how can i read data from an extern i2c sensor on pin 22 and 23 on the IoT Card form the mangoh yellow. IoT Expansion Cards: adding sensors and networks connectivity
With that data i will send it with mqtt to a mqtt broker.
sorry for my bad explanation!

have you tried the i2c command?

root@swi-mdm9x28-wp:~# i2c
i2cdetect i2cget i2cset.i2c-tools
i2cdetect.i2c-tools i2cget.i2c-tools i2ctransfer
i2cdump i2cgpioctl
i2cdump.i2c-tools i2cset

I get this error after executing the command
afbeelding

i2cdetect does work

that is just to show you what command begins with “i2c” !!!

My bad, i’m sorry. I get it, but with what command can i read the data?

is it “i2cget”???..