INA219 Sensor Dashboard


#1

Hello,
I am French and in a few months I pass my baccalaureate, I am in technological fili, more precisely STI2D, all that to say that I am doing a project which will be determinant for obtaining my diploma, and I have some problems with this one.

I made a program against which works perfectly well on Raspberry PI 0 to recover the data of a sensor INA219 in order to know the generated power of a portable generator, INA.txt (643 Bytes)
, this program is exectuted under python idle 3, but the problem is that I must make a mobile display , I then turned on Cayenne, but I find myself unable to see the data of my sensor INA219 in I2C on the dashboard, could you help me to solve this problem?

Thank you in advance !

KR


#2

I would like to try to have a dashboard like this.

Dashboard


#3

Basically you can just merge that code in to this example code. Since you’re working on a school project I’m inclined to let you struggle a bit instead of handing you a solution, but if you get stuck post back and we’ll try to help.


#4

Thank you very much for your response, I engage my research on the subject!


#5

Hello, I come back to you because I’m stuck for a few days now, I realized several different codes to reach my goal help me from several sources but I can not, I encounter syntax errors and I do not know where to integrate the code in the latter I do not understand much anymore. I turn to you knowing that the deadline for my project is approaching. Thank you in advance !

INA219_only.txt (693 Bytes)

INA219_Cayenne.txt (1.4 KB)


#6

What was the code you were trying, and what errors are you getting?


#7

The code I tried is as follows:

INA219_Cayenne.txt (1.4 KB)

I execute it under IDLE 3 and I have all the time errors of syntax or invalid argument.


#8

What are the errors?


#9

the errors are for example the syntax for void loop () or for cayenne.run (), the loop is highlighted in red and I try hundreds of things without this program works.


#10

Without seeing the error it’s hard to tell what’s wrong. I do see that on lines 6, 7, 8, 10, and 12 you are missing a ; at the end of the line. If you send the error I can help more.


#11


#12

Lets back up a bit. It looks like you are running this with Python, but in your file you are using part python, part Arudino sketch. I missed your imports at the top earlier and thought this was for an Arduino board. You will need to figure out what you need out of that Arduino sketch and convert it to something that will run in Python.


#13

I am a little lost, I try to make sure to have the dashboard as above, but I can not do it, I just have my raspberry 0, an ina219 sensor in i2c and my basic program which picks up the sensor information. But I can not seem to be able to display cayenne information using MQTT.


#14

Here is the example Python MQTT file. You need to take your first file INA.txt and merge it in. Discard the Arduino code, wherever you got that.


#15

like this ? but how will it appear in Cayenne?
file.txt (937 Bytes)


#16

Sorry, I’m not going to hand you the answer if you are working on a school project. I would suggest trying the examples here until you understand the code and then working in the code to read your sensor.