question

cedrock avatar image

Raspberry Pi 3B+ Heat (temperature)

Hi All

Just installed a raspberry Pi 3B+ with Venus GX Firmware as a gataway for my solar system on my boat.

It works pretty fine!

I used the official Pi3 Case for it.

I didn't install any heatsink or fan.

As it can get pretty warm in my boat, just wondering how the device can handle the temperature?

What happen if it would overheat? It will power down automaticly?

Is it nessesary to install a heatsink or fan or I'am good to go how it is right now?


Does anyone has some exprerience on that topic?


Many thanks

Raspberry Pitemperature
2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

5 Answers
laurenceh avatar image
laurenceh answered ·

Right all posted to GitHub - as I'm away from my boat at the moment and did not want to break anything in the code I have left in a lot of code (just commented it out) so you get free extras:

  • How to read data from I2c and publish it to DBus
  • How to read data from extra adc inputs
  • How to interface to the Victron persistent setting interface

(so that you can store names, offsets and slopes for extra devices)

38 comments
2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Thanks for sharing @laurenceh , i tried to find it on Github but could't. Do you have a link for me?

Still getting to grips with GitHub I think I have made this under my own account it should be open for public reading.

https://github.com/LHardwick-git/Victron-Service

laurence

Yes, now i found it. Will have a look and see if i can install it on my rpi3+ somewhere coming days.

Hi @laurenceh,

I've got it working according to your instructions on Github. There is however a small step that can be a problem for other not so skilled users. In step 4 of your instructions you forgot to mention that file "dbus-i2c.py" also need to be made executable like the other files. In case you don't, you end up with permission problems when giving the command "bash start-i2c.sh".

And when it is all running the temperature appeared as battery temperature in my case. This is simply to be solved by manually give a correct name at the device properties.

Again thanks for sharing this with us!

1612019602131.png

1612019602131.png (48.7 KiB)

Hi @PowerAce yes it was more a question that it did say it in the readme but just hidden because I did not know how to split lines in a gitHub README.

I have edited the readme (I guess you can resync to my main) the readme now more clearly says:

Set execute on the following files (Sadly storing things on github does not preserve execute bits)
dbus-i2c/i2c.py
dbus-i2c/start-i2c.sh
dbus-i2c/check-i2c.sh - this is just a simple file you can use to check if the service is running
dbus-i2c/service/run
/service/dbus-i2c

The command is
chmod a+x

@LaurenceH Just to confirm, is this is for RPi Only as I see you have a couple of references to 'Victron GX' in your readme file. Will this work for other GX devices as well?

There is a good chance it will work in Victron GX devices as they also use Arm cores.

It is easy to check, have a look and see if the system device used by the service exists and cat the system file to see what it contains.

In the other hand it might rely on a specific device feature of the Arm processor used in the RPi in which case it won’t work. The check above will tell you one way of the other.

Thanks for the reply. I doubt however that it's possible to measure CPU temperature on the AM335x CPUs. From the datasheet it's internal and not user accessible without some work. They call it a Bandgap sensor or something used by the factory only.

That the sensor is embedded on the chip is kind of the point. It is accessible at register level on the AM335x so if the OS implements the interface then the temperature will be available. The Venus OS on both GX and RPi devices is based on the open embedded linux distro so the interface is likely to be consistent across Arm chips. Do check for the presence of the system file, it is really the only way to tell.

/sys/devices/virtual/thermal/thermal_zone0/temp



It's not present (empty directory). Let me rephrase, the path does not exist as per your example, the only path to a thermal directory is /sys/class/thermal and that one is empty.

Ok that is clear we should post an idea/suggestion for Victron to make the temperature available. The use case is clear - systems (mobile or static) in hot environments where the risk of device overheating needs to be mitigated.

I’ll post something later today.

I absolutely agree. The system temperature is relevant in many installations. Especially where it is installed in small rooms together with other equipments as well

I have posted the idea in modifications.


https://community.victronenergy.com/idea/75515/victron-gx-devices-internal-temperature-on-ui-and.html

Do upvote if you think it’s a good idea.

I have no direct interest as I run Venus on an RPi.

Hello,

I just installed the addon to read the CPU temperature. Installation was easy thanks to the great tutorial from Laurence.

It directly integrates into the system (Venus Screen, VRM and Node-Red)

Next step is to use the code to integrate some BME280 Sensors. Hope I can manage it.

Thanks again for the great work!

Cheers

Dirk

vrm-cpu-temp.jpg

node-red-cpu-temp.jpg

venus-os-screen.jpg

venus-os-screen.jpg (40.0 KiB)
vrm-cpu-temp.jpg (23.0 KiB)
vrm-cpu-temp.jpg (23.0 KiB)

Looking forward to test this as well..... Also I am wondere how to get the tank levels into the gui as well. I have water and diesel, but not the waste tank. Is there a way to use the existing level sensors in the diesel and water tank? When it comes to the waste tank I am trying to figure out what I need besides of those: https://www.aliexpress.com/item/33041900609.html

BME280 appears to be i2c - you will need to add to config.txt.

Here is a line from my config shell script.

echo 'dtparam=i2c_arm=on' >> /u-boot/config.txt

You will need to add a new device class to the i2c.py lib to read the right registers of the BME280 as the device address and registers are different from the AM2320.

Good luck, I'm interested to hear how you get on.


Yes the BME280 is an i2c sensor. I use this sensor in my esp32 projects and there integration is not an issue thanks to exzellent libaries.

I will keep you updated.

Thanks again for your effort!

Hi dirkmuc - have you managed to get your BME280 working....struggling with my limited knowledge....Best Mischa

Hi,

I managed to get sensor readings on the console. I am struggling to get the data onto the dbus. It's a trial and error work for me since I do not now much about programming.

Cheers

Dirk

@dirkmuc if you cut and paste here an example of the console line or lines you need to use and what reply you get in the console. I’ll have a go at updating my code to include the BME280 support.

Laurence

@laurenceh

I managed to get temperature. Now I have to figure out how to get humidity and pressure onto the screen and into vrm....

Cheers

Dirk

screenshot-20210218-213214.jpg

Hello @laurenceh, all

hopefully you can figure it out. As written above I can see the temperature value, but no humidity. I do not see any mistake as when I read the humidity value with

dbusservice['i2c-temp']['/Temperature'] = data.humidity

the output is correct. Humidity values are shown in the GUI, yes as a temperature ;-)

But I can not see both or in an ideal world I would like to add the pressure as well and see all three values in the GUI in one line like with the BMV. The pressure values are available with data.pressure.

I attached my version of dbus-i2c.py so if you have time it would be great to have a look into it. Of cause anybody else can also check it ;-)

Cheers

Dirk

dbus-i2c.py.zip


dbus-i2cpy.zip (5.0 KiB)

@dirkmuc

Well done -yes you are right the Console and VRM will only display temperatures automatically, but as you have seen you can label a temperature values as anything, you have already named a temperature as BME280 on the console and it works.

So you need two more temperature services and just give them names which tell you what they are:

I think something like the following will work, find this bit in the code:

dbusservice['i2c-temp']     = new_service(base, 'temperature', 'i2c',      'i2c Device 1',  0, 25, 7) 
dbusservice['i2c-humidity'] = new_service(base, 'humidity',    'i2c',      'i2c Device 1',  0, 25)
# Tidy up custom or missing items
dbusservice['i2c-temp']    ['/ProductName']     = 'BME280'
dbusservice['i2c-humidity']['/ProductName']     = 'BME280'

Change to

Note: you need to increment the instance ID and the setting ID for each new service of the same type, so se I have used 25-26-27.

dbusservice['i2c-temp']     = new_service(base, 'temperature', 'i2c',      'i2c Device 1',  0, 25, 7) 
dbusservice['i2c-humidity'] = new_service(base, 'temperature',    'i2c',      'i2c Device 1',  0, 26, 8)
# Tidy up custom or missing items
dbusservice['i2c-temp']    ['/ProductName']     = 'BME280 temperature'
dbusservice['i2c-humidity']['/ProductName']     = 'BME280 humidity'

Then change where you read the data to this.

        dbusservice['i2c-humidity']['/Temperature'] = data.humidity
        dbusservice['i2c-temp']['/Temperature'] = data.temperature


Yes I know its weird but it should work. The Console and VRM dont care what they are connected to as long as you pretend it is a Temperature!

Then just add extra lines to make a new service for the Pressure.

dbusservice['i2c-pressure']     = new_service(base, 'temperature', 'i2c',      'i2c Device 1',  0, 27, 9)
 dbusservice['i2c-pressure']['/ProductName']     = 'BME280 pressure'

And another line to read the data.

        dbusservice['i2c-pressure']['/Temperature'] = data.pressure

I'm not sure how Venus will react to a temperature of 1,013 which is 1 atm in hPa so perhaps convert to kPa which will sit around 101.3.

Let me know how you get on - sorry Im not at my my boat at the moment so I can't test my suggested changes.

NOTE you can change the device name in the Console settings. You dont have to change the code if you decide you would like to just change the name - the setting screen is here.screenshot-2021-02-19-at-170748.png


Good Luck - Laurence




@laurenceh

Thank you so much! I will test it over the weekend.

Cheers

Dirk

@LaurenceH

I tested your solution and yes that was the solution with one little addition.

Instead of

dbusservice['i2c-humidity'] = new_service(base, 'temperature',    'i2c',      'i2c Device 1',  0, 26, 8)

I had to use

dbusservice['i2c-humidity'] = new_service(base, 'temperature',    'i2c',      'i2c Device 1',  5, 26, 8)

The "5" made the difference. The same applied for the pressure, there I use "4, 27, 9"

venus-with-bme280.png OK, everything is in °C, but that's expected.

Thanks again fo your effort.

Next step is to combine them to read the values in one line.

My reading/learning starts now...

Cheers

Dirk

Glad it worked, thankfully the °C is not quite as obvious on the VRM.

You are right I should have spotted the 'id' parameter needs to be unique as well when declaring a service.

It really would be nice for Victron to make the minor mods needed in the dBus libraries and VRM to allow users to use the interface for generic values with programable scale text so we could label them kPa and % rel as we have now proved it is possible.

Thanks @LaurenceH and @dirkmuc - all data running from the BME 280 into my Venus Raspberry further on to VRM - and then via MQTT into my OpenHab home automation system, where I can show the real units...

If will see, if I can try this also for an SCD30 (which includes CO2)...

Hello,

@LaurenceH @mehlers I have one question. I have the issue that the values are frozen after around 3 hours. When I change the update time the values are frozen accordingly. I assume that there is a kind of buffer overflow, but I really do not no where to look. The sensor is fine, I can read it out in the console even when the script is frozen.

Thank you for your support

Dirk

Show more comments

Took me a bit to get it running on a Pi4. Had to make /service/dbus-i2c/run executable.

Thanks for your effort!

@LaurenceH Hi, after upgrading til 2.66 this seems not to work anymore. I understand a upgrade will delete this hack so I installed it again according to your instructions, but still can't see it working... Did you verify it on the 2.66 ?

Kurt

I have just installed a fresh 2.66 test system today, I have the core dbus-i2c code working without problem (returning Rpi CPU temperature). Analogue interface is also working. I don’t have any i2c devices on my bench right now. I was going to try interfacing some 1Wire devices using owfs.

Can you explain what is not working? Have you checked the log files in /var/log/dbus-i2c for any clues?

If dbus-i2c is not running, you can run it from the command line and see what it reports on the terminal.

Laurence



Hmmm..... .strange. I have done upgrading earlier without problems so I was thinking there where something with that particular version. I did review the files, rights and executables and so on - so I don't know. I am not at the boat now, but will take a look at the logs as I do not remember the content except it did not make sense to my limited knowledge :-)

I am in the situation to look at forwarding shh through the router, but from a security perspective I do not like the idea... so, then I have to wait :-|


I'll come back to you later on.......

I just installed this on an RPI 4 running v2.70~6 and it came right up.

If you are hand installing this, make sure the run files are executable or the service won't run.

Did some checks and there was a file without the execute bit. Got it working now :-)

Tnx

cedrock avatar image
cedrock answered ·

Hi Power Ace

I could monitor the System now for a Week on the Lake with high outside temperature.

I agree with you. Couldn't notice any issues so far.


Thank you for your answer

2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

powerace avatar image
powerace answered ·

Hi cedrock,


I've same RPi running in my RV without heatsinks. It is mounted in the 7 inch screen housing which allows a little airflow. When the RV is parked in the sun it becomes easily over 40 degree Celsius inside. Until now i did not experience a heat probleem with the RPI but it is well possible that the processor slows down its clockspeed although i cant really notice that using the gui. Ultimately i expect that the system simply locks up when it becomes to hot.

2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

kurtinge avatar image
kurtinge answered ·

Thanks alot, @laurenceh !! Easy implementation. Really appreciate it. At the moment it is winter here so it stays at 44C. Theis feature will be very nice when summer is coming. The RPi is at the moment mounted in the same room as both the charger and the MPPT which is also neighbour room of the engine room. My guess is that this compartment will be quite warm if I go by engine for hours. Again, thanx alot !!!

2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

bradfordharley avatar image
bradfordharley answered ·

I am on the hard in mexico and it's regularly 100 f in the boat. The 3b+ is fine within an enclosure. You can view/monitor the temperature by looking at /sys/devices/virtual/thermal/thermal_zone0#. It's in C and divide by 1000. I also have a rpi4 onboard serving a different function, and it does need a fan..


5 comments
2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Thanks for reminding me where to find the CPU temperature. I’ll write a dbus interface for it and being a temperature it will be visible to the VRM. I’ll post a link to the results here.

Well that went well:

I updated my temperature dbus service to include CPU temperature so it's now visible on the VRM and console.

I also checked the Rasberry pi advice and any CPU temperature below 80°C is fine. My Rasberry pi is in a 7" touch screen case with an analogue board attached.

If anyone would like the code I'll extract it form my other services and post it.

Hi!

Great feature. Could you please share the configurations needed to accomplish this?


regards


Please put your Venus mods up on GitHub. Links here tend to get buried.

Thanks.

I’ll see what I can do over the weekend I am away from my narrowboat at the moment.


I’m not used to GitHub so may need to set up an account and work out how to use it.