How could laptop get the signal from DS18B20

#1

Hello, I’m now doing my graduation project called concept for Home-automation with Node-RED. My professor asked me to make a Embedded system that can control the temperatur and the light in a single room.

My problem is that I don’t know how could my laptop get the signal from thermometer like DS18B20 with Node-RED. Should I use Raspberry Pi or some other board like arduino? And which Node should I use?

And how can I send the control signal to an actuator like a Switch.

Node-RED is totally a new concept for me. I even don’t know how to make a good title to explain my problem.

Thanks a lot.

0 Likes

#2

I use owserver for accessing one wire devices, on a pi. A ds18b20 can be connected to a pi just with a pullup resistor provided there is only a short wire on it. Then you can read it using the node-red-contrib-owfs node which will access owserver to get the value.

You can run owserver and node-red in the pi and access the UI via the network on the PC.
You can get a relay board for the pi that will give you a relay output for driving the light.

Actually I wouldn’t do it that way, I would use a Sonoff TH10 flashed with the Sonoff-Tasmota software to do everything except the GUI, which would use node-red on the laptop. But that would only take a couple of hours to get going so wouldn’t be much of a graduation project. However when it can be done so easily with a $10 device does it make sense to have such a trivial project? Perhaps that is not all that is involved in the project.

0 Likes

#3

There are many ways to achieve this. If all you want is to get communications to/from a laptop and you aren’t interested in anything clever (or secure), you could simply use an ESP8266 or ESP32 and a browser on your PC.

There are lots of choices for easier programming of these embedded microprocessors now if you are not familiar with the simplified C++ that is typical. There are options for Python, JavaScript and even MIT Scratch.

If you need more intelligence, you need to decide whether you need the whole thing to run without your PC being present. If you don’t, you can run Node-RED and Mosquitto (MQTT broker) on your PC. Otherwise, you can run a Pi.

Of course, if you are using a Pi, you could simply connect the sensor direct to that.

These are just a few options.

1 Like

#4

I would agree with Julian - using an ESP8266 (for example a Wemos D1 Mini re-flashed with ESP Easy) would create a very simple node to read the DS18B20 (as the driver for the temp sensor is built into the firmware).

You don’t say what sort of light you have to “switch”. Is it mains or low voltage?
You could use a relay if it’s mains >>> BUT BE VERY CAREFUL, the mains can KILL YOU !!!

If it’s an LED then the ESP8266 can drive an LED directly via a current limiting resistor.
Depending on your budget you could just use a single ESP8266 or if you want to make it more sophisticated then (as Julian mentioned) include a Raspberry Pi running Node-Red and MQTT. Then you could create a visual dashboard that shows the temperature and state of the light.

PS:
As Colin mentioned, you could also use a SonOff. The SonOff S20 plugs into a mains socket, then you plug your “light” into the socket. This would avoid having to expose yourself to the mains.
Tasmota fits nicely with SonOff.
You can also re-flash SonOff with ESP Easy…

Hope this helps.

0 Likes

#5

Hi Vfire!
How is your project going?
Discussion seems to have stalled.
Did you get the help you needed?

Charles

0 Likes