Introduction: Arduino WiFi Thermometer (with Web Page) - Arduino Wireless

What you need

  • An Arduino board (any compatible board is OK).
  • LM-35 (to use with the provided file you can use DS18B20 but you have to convert the source code respectively).
  • HLK-RM04 WiFi router module.
  • 5V Power supply or Power supply and regulation circuit.

Step 1: The Idea

Arduino can be easily turned into a thermometer just by using the LM-35 sensor (or any other temperature sensor). There are a ton of examples on the internet about it.

The problem is that in order to read the environment temperature you have to connect the device to the computer using USB connection you have to use an Ethernet shield or a WiFi shield in order to connect the device to TCP/IP Network.

My approach is much cheaper since you can connect any Arduino compatible device even the ones without the USB connection circuit (boards like Arduino Pro Mini) to the TCP/IP network using wireless connection.

TIP: You can create your own Arduino compatible board by using just an ATMEGA328 μP unit and some peripheral parts or you can use Arduino compatible devices like the Redesign Pro Mini atmega328 5V which can be found on ebay.com for about 2,00 €.

The idea of wireless temperature meter can be improved and converted into a complete weather station or it can be used as a low cost WiFi interface to control various devices around your house just by powering up the Arduino based device.

Step 2: The Result

You can get a self-refreshing web page which looks like this (or even better if you tweak the html code).

TIP: HTML is cool. You can access this page from everywhere. You just have to forward one TCP port to your router and the page can be accessed via the internet. So why not access the page just by using you smartphone?

Step 3: ​The Hardware

The connections can be found on the provided diagram. It is assumed that we are using a 12V DC power supply (which is the most common case). The input power is regulated by the 7805 5V DC regulator in order to supply both Arduino and HLK-RM04 WiFi module.

The output from 7805 is connected to 5V Arduino board and pin 1 on the WiFi module. Of course the grounds are connected together.

The Arduino pins 0 and 1 are connected to wireless modules pins 21 and 20 by crossing the RX and TX signals. Pin 1 of Arduino is connected to Pin 21 of HLK-RM04 and Pin 0 is connected to Pin 20.

The temperature sensor provides output on the center pin, so this pin goes to the A1 (Analog pin) on the Arduino board left pin is connected to 5V and right pin to GND (please check the diagram to identify pins).

Step 4: The Wireless Module Configuration

When it is powered with the default configuration the HLK-RM04 WiFi module acts as a wireless access point which can help in order to configure it properly for our application.

Configuration procedure:

  • By using the wireless network discovery from a PC or tablet or even a smartphone we are looking or a SSID named HI_LINK_xxxx (e.g. HI_LINK_4EBB).

  • We are connecting our device to this wireless network by using the password: 12345678

  • Once we are connected to the network and our device has obtained an IP address from its DHCP we are opening the configuration page of the module by typing the following IP address to a new browser window 192.168.16.254

  • The username is admin and the password is admin as well.

  • On the configuration you should be automatically see the HLK-RM04 Serial2Net setting page.

  • You have to change the settings on this page in order to connect this device to your wireless network.

  • Finally set the serial baud rate to 57600 and the network timeout to 10 seconds.

Check the following video to see all the steps:

Step 5: The Firmware (The Arduino Sketch)

The Arduino sketch is mainly based on the work provided by http://rayshobby.net/?p=9592

The provided code can be improved to format the output page as you like (although HTML formating is a bit of pain to converted to code).

Step 6: About HLK-RM04

The HLK-RM04 is a low cost wired / wireless router with serial ports. You can find more info about it here: http://www.hlktech.net/product_detail.php?ProId=39

You can buy themodule from ebay for around 10,00 € http://www.ebay.com/sch/i.html?_from=R40&_trksid=p... . However be careful when you are selecting the device since most of the times it is provided without the antenna pigtail. So when you are bidding please check if the antenna is included.

There is also a version with ceramic antenna fitted on board which is not requires any other antenna component.

Finally be noticed that the module's pinout is 2mm which can not fit on standard breadboards.

Comments

author
MikeD11 (author)2015-04-28

Hi, Now I'm trying to send my temp data to ThingSpeak. They will store the data and graph it for me! If only I could figure it out, sad.

author
Pogo28 (author)MikeD112017-07-23

Hi Mike, How's ThingSpeak with you? Have you figured it out yet?

I am trying it now but could not figure it out yet.

author
MikeD11 (author)Pogo282017-07-25

Yes, I've been tracking my solar power collection for years now! https://thingspeak.com/channels/34247
Mike

author
limbo (author)MikeD112015-04-28

Ahhh These API calls...
I tried to use an ESP8266 module to connect a couple of months ago.
I think is doable with this module too but I don't have time to test it...

Please don't loose your faith! KEEP ON

author
ravindarmay (author)2016-12-20

Sir, Great tutorial! can we code them without using arduino ? Rm04 has flash memory cant we code on that memory? I m new to uart module i have used esp8266 and i find this module very different .waiting for your reply !

author
limbo (author)ravindarmay2016-12-28

HLK-RM04 documentation is very limited. you can't use it to avoid Arduino usage.
If you like a different solution you should go to ESP-8266

author
rserroyen made it! (author)2015-10-28

I have a HLK-RM04 but the problem is that my PC does not see the "device" I tried to WPA /TKIP and WPA/WPA2 TKIP but without success. Can you help me?

1.jpg2.jpg
author
RishabhB3 (author)2015-04-29

I made all the configurations. I am able to access the settings page of the wifi module via my router now. But when I try to access the 8080 port, nothing is happening. I have tried everything, can you help me?

author
limbo (author)RishabhB32015-04-29

Have you uploaded the provided sketch the Arduino?
Please have in mind that the displayed page is created by Arduino sketch, the wifi module just translates the TCP/IP to serial messages.

Also check the RX TX connection between Arduino and wifi module

author
RishabhB3 (author)limbo2015-04-29

yes i have. I even interchanged tx rx.

on the serial monitor its transmitting data, but only when I send anything with the return key.

the 192.168.1.21:8080 page keeps saying waiting for 192.168.1.21

author
yansaraev (author)2015-04-10

i started configuring module, but then it disappered. maybe i did write somewhere wrong settings, how do i reset to factory settings this module?

author
limbo (author)yansaraev2015-04-13

You have to set pin 10 to ground for 10 seconds...

author
yansaraev (author)limbo2015-04-19

thank you it helped!

author
astro_mike (author)2015-03-18

hi, thx for this info making arduino wireless, I don't suppose someone has some html or vb or vc, preferably vb or vc, for the web page side of this project. I'm stuggling to get my head around it. Thx

author
limbo (author)astro_mike2015-03-18

Actually the web page is a part of Arduino code.

All the html code is combined in one variable which is "printed" to serial port by the Arduino upon http request, if you check the provided arduino sketch you can understand what is happening.

The background image is actually loaded from a remote server it doesn't served by the arduino code. See latest version here: https://www.dropbox.com/s/t9rihfr8xudlffi/wireless_temp.ino?dl=0

author
MikeD11 (author)2015-03-06

Wow, I got to the Success part. This IP config stuff makes my head hurt. Reset the HLK-RM04 I don't know how many times trying to get the right type secure network and passwords. Really your circuit could use a pullup to 3.3v say 5K resistor to the factory reset, ground pin 25 see factory manual. What the manual doesn't say is power on the HLK-RM04, wait 30 sec, ground pin 25 for 10 seconds.

author
limbo (author)MikeD112015-03-07

Hi Mike. You are right about reset!


I tried to keep it simple, but the rest button seems to be essential.
You can see reset button's connection on the provided image.

HLK-RM04.pdf (SECURED) - Adobe Reader.jpg
author
MikeD11 (author)limbo2015-03-07

Nice drawing Limbo but your setting the mode pin 10. Factory reset is pin 25. So if your drawing showed 25 it would be fantastic! Mine is now fully functional and I'm modifying the heck out of it. Only lost a little hair over it!

author
limbo (author)MikeD112015-03-07

https://www.dropbox.com/s/zmnza01wedbu81o/HLK-RM04...

Well, both 10 and 25 pins are reset default according to manual. Actually I'm using 10 to reset my modules.
The drawing is taken from module's datasheet. (link provided)

HLK-RM04.pdf (SECURED) - Adobe Reader.jpg

About This Instructable

43,133views

47favorites

License:

More by limbo:Web Clock Version 2.0 (ESP8266 - Wemos)Simple Component Holder (Third Hand) For SolderingArduino WiFi Thermometer (with web page) - Arduino wireless
Add instructable to: