Tekforums

Chat => Guides & Projects => Topic started by: knighty on July 03, 2022, 13:51:30 PM

Title: temp sensors display to webpage
Post by: knighty on July 03, 2022, 13:51:30 PM
I want to be able to monitor freezer temperatures at work and check them remotely

there's a million options when I google it... but no real plug n play options....

I'm working crazy hours and haven't done any programing etc. in donkeys years, I'll be going through idiots guides etc. to set stuff up

I've got a server running already for cctv and gps tracking, so can run something on there

would rather avoid the cloud and subscription services etc.

anyone have any ideas?


I honestly thought I'd be able to buy a bunch of POE temp sensors download a bit of software and but up and running straight away :-o


my little brother does PLC stuff.... had him price up a basic PLC system to do it.... £1400 :-o
Title: Re: temp sensors display to webpage
Post by: Clock'd 0Ne on July 04, 2022, 09:18:03 AM
I would imagine the simplest setup for this would be something like a Raspberry Pi or Arduino with some thermometers working off the headers. A quick Google turned up this guide:

https://medium.com/initial-state/how-to-build-a-raspberry-pi-temperature-monitor-8c2f70acaea9

Which is using something called Initial State (though its not free) as the web dashboard where the data is streamed to, but it wouldn't be too difficult to modify this to work with something home baked that runs off your own server. Might be a good starting point!
Title: Re: temp sensors display to webpage
Post by: knighty on July 05, 2022, 12:10:51 PM
I've ordered an Arduino and a bunch of temp sensors, saw another guide I'll try to follow

I think half the problem is there's loads of different guides all doing it different ways

I'll report back when it all arrives :-o
Title: Re: temp sensors display to webpage
Post by: neXus on July 06, 2022, 02:19:46 AM
You do not really need to do all the work and have arduino.
If there are any wifi assisted devices using a number of the specs you just need to have https://www.home-assistant.io/ Home assistant setup on a machine, docker, VM etc. Runs in a lot of environments.
You have your devices, detected and then they will most likely do stuff and have options out the box and feed into a heap of extensions/plugins available etc for that.
If you need to do more home assistant has full API so you can feed it to a web page.
BUT home assistant interface is web based and you can set it to access your home assistant across the internet so it can be very likely on the dashboard you setup etc you wont need to do anything more. You can do sending emails or text messages etc all through it if needed, send to devices so google can announce something is overheating and so on.
Title: Re: temp sensors display to webpage
Post by: knighty on July 11, 2022, 01:08:04 AM
I'm following this guide
https://randomnerdtutorials.com/esp8266-ds18b20-temperature-sensor-web-server-with-arduino-ide/

had it working with 1 temp sensor + code

had it working with 2 temp sensor + code

trying for the web page and I'm getting this error...

Code: [Select]
Arduino: 1.8.19 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

sketch_jul11a:15:12: fatal error: C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2/tools/sdk/include/ESPAsyncWebServer.h>: Invalid argument

Multiple libraries were found for "ESPAsyncTCP.h"

   15 |   #include <ESPAsyncWebServer.h>S

 Used: C:\Program Files (x86)\Arduino\libraries\ESPAsyncTCP

      |            ^~~~~~~~~~~~~~~~~~~~~~

 Not used: C:\Users\USER\Documents\Arduino\libraries\ESPAsyncTCP-master

compilation terminated.

exit status 1

C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2/tools/sdk/include/ESPAsyncWebServer.h>: Invalid argument



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


any ideas anyone?

google isn't helping me, adding removing libraries isn't helping me, fresh download isn't helping me

I'm stuck

it's 1am and I've been at work since 8am, guess it might be more clear in the morning, I'm going home
Title: Re: temp sensors display to webpage
Post by: Clock'd 0Ne on July 11, 2022, 06:56:26 AM
https://forum.arduino.cc/t/error-with-esp8266-libray/578978

Looks like you might not need to install that library separately?  :dunno:

This guy has your error and fixed it installing some missing dependencies:
https://github.com/Aircoookie/WLED/issues/584
Title: Re: temp sensors display to webpage
Post by: neXus on July 11, 2022, 07:12:39 AM
Not across their coding setup but when you get those sorts of library issues/errors it means multiple versions of the same library being called.


If there is a build/library/package manager just go in and remove the ESPAsyncTCP-master one.
Often if you switch your build or branch for a package etc the old legacy is there so if you run a code Build it runs both. There would be a clean/clear function to clear out?
That or just go to that folder and delete the master one or other depending on which one your actually including in your project.
Title: Re: temp sensors display to webpage
Post by: XEntity on July 11, 2022, 08:41:33 AM
Not across their coding setup but when you get those sorts of library issues/errors it means multiple versions of the same library being called.


If there is a build/library/package manager just go in and remove the ESPAsyncTCP-master one.
Often if you switch your build or branch for a package etc the old legacy is there so if you run a code Build it runs both. There would be a clean/clear function to clear out?
That or just go to that folder and delete the master one or other depending on which one your actually including in your project.

Looks like it's the other one causing the issue, so just copy this folder out of this location (in case you need to put it back): C:\Program Files (x86)\Arduino\libraries\ESPAsyncTCP
Title: Re: temp sensors display to webpage
Post by: knighty on July 11, 2022, 14:18:55 PM
ok... now I get....

Code: [Select]
Arduino: 1.8.19 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"





















sketch_jul11a:15:12: fatal error: C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2/tools/sdk/include/ESPAsyncWebServer.h>: Invalid argument

   15 |   #include <ESPAsyncWebServer.h>S

      |            ^~~~~~~~~~~~~~~~~~~~~~

compilation terminated.

exit status 1

C:\Users\USER\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2/tools/sdk/include/ESPAsyncWebServer.h>: Invalid argument



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Title: Re: temp sensors display to webpage
Post by: neXus on July 12, 2022, 08:03:28 AM
That means the library the code needs is not there so it does not understand what that does.
So Either...
You removed the wrong one
Part of your code is using one and another part is using the other and there are conflicts.

Title: Re: temp sensors display to webpage
Post by: knighty on July 12, 2022, 23:17:21 PM
That means the library the code needs is not there so it does not understand what that does.
So Either...
You removed the wrong one
Part of your code is using one and another part is using the other and there are conflicts.

I put them all back as per he guides, uninstalled Arduino ide deleted the folder and reinstalled it too


I'm lost... I thought it would practically be plug in and play

I'll try on another computer incase somehting weird is going on
Title: Re: temp sensors display to webpage
Post by: XEntity on July 13, 2022, 08:21:20 AM
Which board are you using, you said you ordered an arduino but the guide is for an ESP?

I assume you’re using a Node MCU if you can tell me which one and pastebin your code I’ll have a go this evening and if I can get it working I’ll send you the ide
Title: Re: temp sensors display to webpage
Post by: knighty on July 13, 2022, 23:52:16 PM
thanks!

this board

https://www.amazon.co.uk/gp/product/B074Q2WM1Y/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1

and I'm copying/pasting the code from here

https://randomnerdtutorials.com/esp8266-ds18b20-temperature-sensor-web-server-with-arduino-ide/?unapproved=768152&moderation-hash=f34f44158302a7ead027b912f984c53a#comment-768152


had it working find outputting temp readings via serial, can;t get it to compile other stuff

made all sorts of arduino led cubes etc. with my nephew when he was little... programing was no problem... feel like I'm banghing my head on a wall now
Title: Re: temp sensors display to webpage
Post by: XEntity on July 14, 2022, 09:28:32 AM
You have two issues:

The code you copied is wrong, this line shouldn't have an S on the end:
 #include <ESPAsyncWebServer.h>S

In your logs it was showing the location with -master on the end you should have removed this from the folder title.

If you still can't get it to work let me know :)

Title: Re: temp sensors display to webpage
Post by: knighty on July 14, 2022, 22:59:59 PM
ok... code compiles now but I've done something wrong somewhere

there' no serial output, and it's not connecting to wifi (not getting any ip address anyway)

ran the other temp sensor code that worked before (output temp to serial) and there's not output from it

uploaded the blink tutorial - onboard led blinks as it should

tried a different board (with no temp sensors attached) and it's the same

no idea what I've done wrong, still at work and still have more graft to do, I'll leave it till tomorrow now :-(
Title: Re: temp sensors display to webpage
Post by: XEntity on July 14, 2022, 23:33:29 PM
Make sure your baud is 115200 and if your WiFi has special characters I think they can cause issues
Title: Re: temp sensors display to webpage
Post by: knighty on July 15, 2022, 19:48:52 PM
ok this is driving my crazy

fresh install on laptop, followed guide exactly (just like I did before)

can't get any temp sensor code to run on any board (bought 3)  (I'm assuming I should still get some output with no temp sensors attached to the 2nd and 3rd boards)

I can load up the example blink code to make the onboard led blink, it works every time on any board

no idea what's going on, I'm probably doing something stupid

I'll take the boards home over the weekend and see if I can spend a few hours on them - I've been in past midnight every night this week, just working on this while I stop for a break when my back hurts :-o
Title: Re: temp sensors display to webpage
Post by: knighty on August 03, 2022, 19:37:06 PM
ohhhhhhh I got it working :-)

no idea how... but it works
Title: Re: temp sensors display to webpage
Post by: knighty on August 03, 2022, 19:55:54 PM
I'#ve bodged a load of code together from different things... but I'm stuck... might have sorted it, gimmie a min to edit
Title: Re: temp sensors display to webpage
Post by: XEntity on August 03, 2022, 21:38:14 PM
Just refresh the page, add the below for every 5 seconds:

<meta http-equiv="refresh" content="5">

More pages are possible, but not done it myself
Title: Re: temp sensors display to webpage
Post by: knighty on August 03, 2022, 21:55:07 PM
perfect thanks, got it working now with  10 temp sensors :-)



instead of an extra page I could just add a bit gap and put the other info lower down :-)
Title: Re: temp sensors display to webpage
Post by: XEntity on August 03, 2022, 22:12:26 PM
Yeah, just use <br> to add a break or multiple for a bigger gap
Title: Re: temp sensors display to webpage
Post by: knighty on August 03, 2022, 22:48:05 PM
It would be good to check which fridge is on/off/defrosting

I thought I'd able to find some digital current clamps easily...  but I'm hunting and can't find any at all

don;t want to wire each one back to the board individually... there'll be a load of them.... I assumed there'd be some digital version a bit like the temp sensors where I'm just paralleling them all up :-(
Title: Re: temp sensors display to webpage
Post by: XEntity on August 03, 2022, 23:16:26 PM
If you just need to know if current is flowing then something like a Hall effect sensor might be able to detect the magnetic difference?

Edit: turns out a current clamp uses a Hall effect sensor.. so that’s likely what you need
Title: Re: temp sensors display to webpage
Post by: Clock'd 0Ne on August 04, 2022, 13:12:45 PM
Glad you got it working!
Title: Re: temp sensors display to webpage
Post by: knighty on August 04, 2022, 17:07:55 PM
(https://imgur.com/a/589mZnz)

I wonder if it's worth sticking them all in a cup of water and then adjusting the readings a bit so they're all the same....

I was thinking by the time I extend them all that'll throw the readings off.... but they're digital so that shouldn't matter?


going to buy another 10 to setup now and label them all 1 to 20.... can just imagine the pain in the arse it'll be trying to organise which one is which if I do it later :-o
Title: Re: temp sensors display to webpage
Post by: XEntity on August 04, 2022, 18:37:45 PM
How long are your wire runs to the sensors? Long wires will add resistance and throw off readings, if running long cables you’d be better running multiple mcus and compile the readings to a single source..
Title: Re: temp sensors display to webpage
Post by: knighty on August 04, 2022, 19:32:49 PM
How long are your wire runs to the sensors? Long wires will add resistance and throw off readings, if running long cables you’d be better running multiple mcus and compile the readings to a single source..

any tips on the best way to do that?

google is telling me I should run home assistant or something like that?

I'd like to keep it as off the shelf as possible



also.... looking to sense if things are on/off (detecting mains voltage) it looking like a pain in the arse...
Title: Re: temp sensors display to webpage
Post by: XEntity on August 04, 2022, 20:31:06 PM
TBH you’re probably starting to look at ESPHome and node red to store the data, you could then use Grafana to present the data if you want a pretty front end (the first two I haven’t used though, although that’s the usual pairing that’s recommended.. but that’s basically starting again, but using good existing tech..

Otherwise the basic solution is getting each esp to post values to another esp to present, but again that’s a fair amount of work

Sensing power did you look at the Hall effect sensor (running passively against the cable)
Title: Re: temp sensors display to webpage
Post by: knighty on August 05, 2022, 09:46:06 AM
looked at hall effect sensors, but can't find any that use the 1-wire system like the temp sensors do

all the ones I can find are analogue so need so need to be wired back to individual pins on the board - there's a million people asking the same question and non are getting a good answer :-(

there are 1 wre light sensors.... so I could use those and wire LEDs into the mains supply... but they're £20 each and I really want a load of them  (would make checking for freezer problems a million times easier)

once I'm finished I'd really like to tweek how the freezers work to make them more efficient


I'll keep looking :-)
Title: Re: temp sensors display to webpage
Post by: knighty on August 05, 2022, 21:40:50 PM
joined all the connecotrs on the back of a 24 port patch panel together, put an rj45 on the board and one on the temp probs... all working so far

means I can wire individual temp probs (or groups) with cat5 and stick an rj45 on the end to make it easy to set the system up

I'll get the temperature web page going first and then expand from there :-)
Title: Re: temp sensors display to webpage
Post by: knighty on August 16, 2022, 23:20:04 PM
ok... I got a bit carried away....

I've got home assistant running in a VM on my server

temp sensors all working, displaying temp in thome assistant


this is where I got carried away.... I bought a bunch of RGB leg bulbs... so I can get home assistant to change the bulb colour depending on freezer temperature...


anyone any good with home assistant?
Title: Re: temp sensors display to webpage
Post by: neXus on August 17, 2022, 01:54:25 AM
ok... I got a bit carried away....

I've got home assistant running in a VM on my server

temp sensors all working, displaying temp in thome assistant


this is where I got carried away.... I bought a bunch of RGB leg bulbs... so I can get home assistant to change the bulb colour depending on freezer temperature...


anyone any good with home assistant?
Home assistant is awesome. Their site makes it look like its really crappy and old but the thing itself and the interface and features are well polished at this point.


RGB lights running off home assistant you can just do all sorts.
You will need to make sure you got the entities (Lights and sensor) detected and controllable through home assistant. Then it will be just writing a YAML script for that.
This may help?


https://www.home-assistant.io/integrations/light/
Title: Re: temp sensors display to webpage
Post by: knighty on August 17, 2022, 19:49:47 PM
it's all up and running.... well one bulb linked to one temp sensor and the temp sensor isn't in the freezer yet... but you get the idea :-)

Quote
- id: '1660686610046'
  alias: change bulb
  description: ''
  trigger:
  - platform: state
    entity_id: sensor.temp1
  condition: []
  action:
    service: light.turn_on
    target:
      entity_id: light.wiz_rgbw_tunable_44a1ea
    data:
      rgb_color: >
          {% if states.sensor.temp1.state | int <= -25 %} [0, 0, 255]
          {% elif states.sensor.temp1.state | int <= -20 %} [51, 51, 255]
          {% elif states.sensor.temp1.state | int <= -15 %} [102, 102, 255]
          {% elif states.sensor.temp1.state | int <= -10 %} [153, 153, 255]
          {% elif states.sensor.temp1.state | int <= -5 %} [204, 204, 255]
          {% elif states.sensor.temp1.state | int <= -0 %} [255, 102, 78]
          {% elif states.sensor.temp1.state | int <= 5 %} [255, 51, 51]
          {% else %} [255, 0, 0]
          {% endif %}
      brightness_pct: 100

took a while to get the hang of the coding, a lot of examples online are for older versions etc. and there's 50 different ways to do everything


but loving home assistant so far :-)