Duet3+SBC: Add Rpi CPU as sensor?



  • Hi!

    Is there a way to add the rpi cpu as a sensor the same way as it is possible to add the duet MCU and drivers?

    I'd like to monitor it as to have fans thermostatically controlled

    Cheers!



  • This was a topic a while back; currently no way to add external sensors to the object model.

    Possible workaround have the Pi poll its own temperature and send g-code to the Duet to control the fan, or use a thermistor from the Duet to get an actual sensor.



  • @fractalengineer said in SBC Temperature:

    Yeah I mounted enclosure fans on my setup which I leave on at low speed all the time but I was thinking having it thermostatically controlled would be nice.

    In Octoprint I was able to have the SBC core temp displayed on the interface

    Tried poking around creating a sensor that wouldn't update and overriding the value, but seems the object model is a one way street for now. The closest you can get is to create a sensor and use g-code from the Pi to update the name of the sensor leaving the value at 2000. (in adittion to g-code to turn an output on/off)

    edit: ooooor put a fixed resistor on a input and change the sensor parameters to map the same resistance to a changing temperature. (thats about so dirty that I'm gonna try it and take a shower after; espescially given I happened to have a 10k dummy lying around..)
    5c88cd4f-8ab4-49f4-bcf3-35004b5f4f45-image.png

    edit2 sort of woks, but there are arbitrary spikes to 0 and 2000 when the sensor is destroyed and re-created(?), even if only using M308 S2 Bn

    6/19/2020, 6:41:18 PM	echo sensors.analog[2].lastReading
    39.3
    6/19/2020, 6:41:11 PM	M308 S2 P"e1temp" Y"thermistor" A"Pi temp" B15000
    6/19/2020, 6:40:58 PM	echo sensors.analog[2].lastReading
    47.0
    6/19/2020, 6:40:46 PM	M308 S2 P"e1temp" Y"thermistor" A"Pi temp" B10000
    6/19/2020, 6:40:32 PM	echo sensors.analog[2].lastReading
    72.4
    6/19/2020, 6:40:28 PM	M308 S2 P"e1temp" Y"thermistor" A"Pi temp" B5000
    

    a9c8adbd-fde6-4ca9-b05d-b0b084f10d59-image.png



  • @bearer said in Duet3+SBC: Add Rpi CPU as sensor?:

    edit2 sort of woks, but there are arbitrary spikes to 0 and 2000 when the sensor is destroyed and re-created(?), even if only using M308 S2 Bn

    @dc42 is this intended behavior or could it be avoided when modifying a sensor? (Duet 2 Wifi + RRF 3.1.1)



  • @bearer hah I didn't remember that comment; it's been a long-awaited feature for me as you can see haha

    I can barely understand what you're trying to do here, but could there be way to use daemon.g in that case?



  • @fractalengineer said in Duet3+SBC: Add Rpi CPU as sensor?:

    I can barely understand what you're trying to do here

    After thinking I could change the name instead of the temperature, i figured that I could actually change the temperature for a fixed value resistor by changing the calibration parameters. I.e. 10k ohm could be made to represent any temperature we want by changing the B paramter (or possibly H or L)

    you'd have a script running on the pi, parsing /proc/ or /sys/ or wherever the temp read is, calculate the appropriate parameter and send the new M308 code to the Duet via echo M308 Sn Bn/Hn/Ln | sudo /opt/dsf/bin/CodeConsole.

    the end result would be that you can graph the Pi temp as if it had an actual thermistor (but admittedly you could also stick the thermistor in the Pi at stage, the other guy didn't have any IO left so didn't think of it)



  • @bearer yeah my IO are also full I'm saving my 4 last ones for a RGBW led strip haha



  • leds only need outputs, if there is an input on the same header it could probably be used?



  • @bearer holy shit I didn't know that



  • @fractalengineer so you mean I can use IO ports in and out for separate stuff?

    Like a thermistor on io7.in and a fan on io7.out??



  • @fractalengineer said in Duet3+SBC: Add Rpi CPU as sensor?:

    so you mean I can use IO ports in and out for separate stuff?

    well, i'd definitively try it - no reason it shouldn't be possible afaik. (but not all inputs are created equal ref https://duet3d.dozuki.com/Wiki/Duet_3_Mainboard_6HC_Hardware_Overview#Section_IO so no thermistor on io7.in in any case)



  • @bearer Ohhh I see it

    b205a95e-a840-4680-bb2a-c44fb501513b-image.png

    Ok so every IO port may not be capable of sending pwm / receiving analog , BUT they can all sense a 3.3 or 5V in (for switch, button, endstops etc...), and/or send a 3.3 or 5V out (for servos(?) led?) am I right?



  • @fractalengineer correct, they're all plain old digital I/O and some are fancy.



  • @bearer well damn I just doubled my IO ports in my head



  • Do note I've not tried if say IO1.out can be used as a digital input but they would have none of the input protection IO1.in has in hardware - and it would be down to the firmware to allow IO1.out to be configured as an input.

    And using IO1.in as an output would probably also be less than ideal; it would only be possible to get it down to about 1v not 0v.

    But hopefully you meant you could use IO1.out independent of IO1.in which i hope to be true.


Log in to reply