Problems recognising a temp sensor on emonPi

Hi there!! I don’t know if I have a connection issue or other …I connect the RJ45 to the EmonPi and (after reboot) don’t have any input.
I connect the 18b20 sensor to a raspberry pi, and it works fine, then, the sensor its ok.
I try to look for (in EmonPi) the folder of w1 devices that I can see in the raspberry
,image
but in the EmonPi doesn’ exist…where are this files ??
I want to find them for ensure that at least, the electric connection is make it well…
Or better I should to test other thing…?¿
thanks!

(I’m going to move your question to a new thread as it is not quite the same discussion.)

On an emonPi, the ds18b20 is connecting to the Arduino-like emonpi add-on board not directly to the RPi bit.

New sensors are only recognized in setup() in the emonpi firmware, so you must restart the emonpi add-on board, this is not done by rebooting the RPi based emonPi device (confusing, I know). Try power cycling the emonPi or using the tiny reset button on the end of the emonPi case.

1 Like

thanks Paul!!

well certainly I reboot (only) the EmonPi, by the button in the administration section … :frowning:
I try to do like you recommends… I short push to the tiny small reset button (long press is shutdown) …appear “shutdown EmonPi” in the LCD …and very quickly again the info of Ethernet … Can I consider that the add-on board is reseted??
(after I reboot also the EmonPi, by the administration section button…)

the input section still with no temperature data…
image

Can you confirm you are using the right RJ45? There is one at each end of the emonPi, one is Ethernet, one is for temp/pulse sensor and they are not interchangeable. The one you want is at the same end as the CT’s and the reset button.

Also, is the RJ45 plug fitted ok or are you using a breakout? You say the sensor works when connected to a RPi, so I assume it is not a factory fitted RJ45, or are you using a RJ45 socket when connecting a shop bought sensor (factory fitted RJ45 plug) to the other RPi? If you are not using a factory fitted RJ45 plug, what terminals are you using?

Hi there!!! great news it works after a complet poweroff …maybe I don’t make properly the reset…
image

I understand that if I want to use the readings of the sensors in a perl script running in the EmonPi is imposible to access this readings like I usually access in a raspberry…

I use the sensor with the raspberry connected directly to the GPIO after for connect to the EmonPi I fitted (grimped) to an RJ45 connector and I test with a female RJ45 again with the raspberry, ensuring the pin numbers…

thanks!

Glad to hear it’s working, it was my error, what I thought was a reset button is just a “RasPi Shutdown” button. When I checked the schematic it isn’t connected to the reset line.

The only way to detect new sensors is to either

  1. Power cycle the whole emonPi (as you have now done). This must be done carefully, the OS is no longer Read-only, so whilst “pulling the plug” was never a good idea, the filesystem is no longer protected as much as it used to be. You must power down the emonPi using the “RasPi shutdown” button or the “Shutdown emonPi” button in emoncms (not the reboot button) and then remove and refit the power connector. OR
  2. SSH in and install a small script to reset the emonpi add-on board. (See How to emonhub full reset the emonpi? - #2 by pb66) a request has been made to include a button on the admin page of emoncms (see remote reset rfm2pi and emonpi addon boards · Issue #1166 · emoncms/emoncms · GitHub)

My bad, the small reset button on the emonpi doesn’t reset the emonpi add-on board as I suggested.

I now know how I got my wires crossed.

Sometime ago I had suggested that instead of a button to just powerdown the RPi on a seperate GPIO pin (as we have now) we should have a reset button (like we have now) but it should be connected to the emonpi add-on boards reset line (and therefore GPIO pin7, used to flash the ATmega328p) NOT to a separate GPIO pin.

This way we would have a way to manually reset just the emonpi add-on board with a quick press and also a way to powerdown the RPi by monitoring GPIO p7 for a long press of the reset button.

When flashing the emonpi board, the listening is suspended and p7 is used (as usual) to flash the firmware, when it’s done it returns to an input pin listening for a powerdown press.

I’ve obviously since forgotten that the “RasPi Shutdown” button is not yet linked to the reset line!!!

(ref Powering down a headless Pi with no network connection)

Hi Paul!

thanks for the explanation!
I do the poweroff with long pressing the “poweroff button” 5…4…3…2…1…
I know that is not good for the filesystem (and more ) cut off power directl…
The other question that I have is :
…now with the sensor connected to the add-on board, how can I access the sensor values from a perl script¿? I need it for some automation…
is it posible ??
thanks!

Yes and no! The temperature sensor is read by the emonpi add-on board, the firmware installed to that passes a processed value via serial to emonHub on the RPi every 5secs, emonhub then publishes that value to MQTT each time, emoncms then subscribes to the MQTT topic and what happens from there in emoncms is up to you. So you can either subscribe to the MQTT exiting emonHub or you can do additional processing in emoncms and either republish it to MQTT, or you could query the feed data via the http(s) api’s.

Depending on what you end goal is, you could possible use nodered to manipulate the MQTT or write a program to subscribe to the MQTT directly. I have no idea if/how PERL can be used with nodered or MQTT, is there a specific reason you want to use perl?

If you want direct access to the raw temperature data from the sensor, I would recommend connecting the sensor to the GPIO as you have said you’ve done to test the sensor. I know the case is a bit of a hurdle, but depending on your skill levels and how involved you want to get. I would possibly look at adding a wire link to the emonpi add-on board so that the existing RJ45 pin for the temp sensor was linked to a spare GPIO pin and recompile the emonpi FW to not use the temp sensor IO pin, that way you can access the temp sensor data in the way you are accustom to, the “normal” 1w GPIO pin on the RPi is p7, but you can define any spare IO pin to be 1w on the RPi.

If you do add a link tin this way, you must ensure you do not accitentally overwrite your custom emonpi FW when using the emonpi update routine. This is easily done by only ever using the “update emonbase” button rather than the “update emonpi” button.

This page provides a sample of MQTT access from Perl.
I think the “least changes” way to get the data would be to subscribe to the MQTT topic from your own Perl script (or other program) as @pb66 suggests.

Hi Greebo and Paul!!

Thank you and sorry for my delay in replying but I’ve been working hard …
my knows about MQTT aren’t enough to do something …(at the moment)
the specific reason to use perl is that the script that make some management of the power of my country house is written in perl … I need manage temps for activate pumps and valves, activate relays, control via ssh miners of criptocurrencies to divert solar energy and in the near future control de power charge of the VE…
just now I try to do the queries of this values from my script by http api’s to he EmonPi, It seems to be the easiest way to me …and less invasive than customize FW and don’t update …etc

Maybe in the future I make some incursions in the MQTT world through the link provided by Greebo I think is very interesting…

thanks !!