Dec 1, 2016

Wireless Temperature Sensor (nrf24L01 & DS18B20)

As I mentioned about IoT Gadgets in the last blog post, I've been developing an "home automation basestation" and gadgets which connects to that. The basestation (BS) itself is connected to wlan and my server via ESP8266. The BS has an DS18B20 temperature sensor and IR led, which controls my AC unit. It also has an nrf24l01 RF module for external wireless sensors and controllers. For now, I have only one wireless temperature sensor, which also has that same temperature sensor and RF module. More of that, the sensor module has ATtiny2313A microcontroller, 1.5 F 5.5 V super capacitor and a solar cell.

The sensor module would run almost forever with AA batteries but that would have been way too boring, so I used a super cap & solar cell combination to learn something new about the power management optimization, sleep modes and current measurement techniques. I also wanted to use an 8-bit AVR microcontroller at least for this revision, although for ex. Gecko EFM32 would have provided a lot smaller current consumption. Just for simplicity, I also left out the energy harvesting IC with solar cell MPPT tracking and buck-boost SMPS output.
Rev. 1 board. Click to enlarge
Just by looking at the operating voltage ranges of every component, the max. voltage of nrf24L01 is 3.3 V and min. voltage of DS18B20 is 3.0 V, so 3.0 V LDO regulator with a low quiescent current could power everything in this module. This sets the usable voltage range of the cap between 3 V and 5.5 V. The load acts as a constant current sink over the voltage range, if we average out the active and sleep state current consumptions. To calculate the time when the voltage of the super cap drops from 5.5 V to 3.0 V, we can use the formula: t = C * [(V1-V2)/I]. So for ex. 1.5 F and 20 uA would make 187 500 seconds, which is ~52 hours with the assumption that we don't put any charge in during that time.

The rev. 1 model was quite large because it had a jumper for every voltage rail, so I could measure the current consumption of any individual component. There was also 3 capacitors (1.5 F, 0.47 F and 330_uF) behind the jumpers so I was able to change the connected capacitance. Rev. 2 doesn't have these jumpers and has only one super capacitor, so it's a lot smaller.

Rev. 2 board. Click to enlarge
As I programmed the first working scratch (1 MHz clock) without any sleep modes, the current consumption was approximately 750 uA, which would drain the cap in 83 minutes. As the MCU stays in sleep state most of the time, we want to use the lowest power sleep state, which is "power-down". Power-down disables timers, except the watchdog, which can be used as a wake-up source even in that deepest sleep mode. Watchdog interrupt function is used to cancel the reset flag before the MCU resets. Just by adding the power-down sleep mode, the average current consumption goes down to 130 uA, which is still 5 times too much.
By lowering the MCU clock from 1 MHz to 250_kHz, enabling the "power reduction register" features in ATtiny, reducing the temperature resolution of DS18B20 from 12 bits (0.0625 °C) to 10 bits (0.25 °C), using the deepest sleep mode of the nrf24l01 and by pulling down any unnecessary microcontrollers pins, the current consumption goes down to 27 uA. Further, we don't really need a temperature reading every 8 seconds (longest WDT range), so the final revision of the program reads the temperature in one interrupt cycle, puts the MCU to sleep already during the 250 ms temperature conversion of the DS18B20 and sends the result it in another cycle. That gives one temperature reading per 16 seconds, which is still well enough, but drops the average current consumption to 13_uA.
Click to enlarge
Download files:

Proteus 7.7 schematic & layout files (zip)
Atmel Studio 6.1 project / source code (zip)

As there is no step-up converter / energy harvesting IC, the open circuit voltage of the solar cell should go quite easily to 5 volts even in mediocre lighting, so the voltage would be higher than capacitor's voltage to allow the charging. The series schottky diode prevents the current from going in wrong direction when there is not enough light for charging. When there is lots of light, the charging voltage needs to be limited to 5.5 V, so the super cap won't blow up. That's done by using a voltage supervisor IC, which controls the mosfet and shorts the solar cell to ground through the 220 Ω resistor, if the voltage goes too high. Zener diode would have been a "single component solution" but they tend to be too leaky in non-conductive region, so it wasn't an option.

Click to enlarge. Sensor module with 2300 uF capacitor(s) as a power supply. Low voltage detection off vs. on
The recommended minimum input voltage range of 3.0 V LDO regulator is ~3.1 volts, but at that low currents, that specific LDO seems to works well above this, although the output voltage obviously starts to follow the input voltage when it goes above 3.0 volts. ATtiny2313A doesn't have an ADC which could be used for voltage monitoring, and the Brown Out Detector would be a bit too extreme, since there's no other option than resetting the whole MCU when it triggers. But there is an analog comparator, which can be used by connecting the internal bandgap reference (1.1 V) and comparing it to the operating voltage, divided with two resistors. I used 100k and 75k resistors, which makes 1.29_V when the operating voltage is 3.0 V. When the operating voltage dips below 2.56 V, the output of the resistor divider goes below 1.1 V and triggers the analog comparator. However, bandgap reference consumes a lot of current (~15 uA) so it's turned on only during the voltage test for a short period of time. If the voltage reaches that point, the DS18B20 doesn't work properly anymore, and measuring the temperature & sending the results are stopped to save some current. At that point we can also send a low voltage warning to the BS. There's also a routine which resetes the system occasionally if the low voltage is detected, so the memory of the MCU, RF module or the digital temperature sensor is refreshed to prevent corruption of the memory and malfunctioning of the system.

Currently I'm logging the temperature readings to my RPi 3 server (just for fun), and the module seems to work very well even in indoor lighting, without a direct sunlight. Next I'm going to put this outdoors when I'll find a good case for it.

68 comments:

  1. I like reading posts from this site because I always find them informative.

    ReplyDelete
  2. Thank you for posting such a useful, impressive Wow.. looking good!

    E waste disposal companies in hyderabad, India

    ReplyDelete
  3. Thank you very much for this blog provided was very helpful information and well appreciated
    electronic product development

    ReplyDelete
  4. Hi this is good to see that you are providing such great service and you giveing it for free. I love type of blogs that understand the value of providing a quality information. Thanks for sharing it very useful for Help AdyaElectronic Appliances For Sale in Delhi.  www.helpadya.com 

    ReplyDelete
  5. Hello Petteri,

    I can't find any contact info in the site so forgive me for using the comment section. I'm Andrei and I'm the webmaster of Sixty Second Tech, a website that features newest electronic product updates and innovations and websites about electronics, electrical and technology.

    I would like to feature you and your blog on my website Sixty Second Tech.

    If you are interested, please email me at andrei@sixtysecondtech.com.

    Hope to hear from you soon.

    ReplyDelete
  6. You might find a number of vacuum cleaners on the basis of different brands, different prices, different types and different quality. However, today you are going to get the information about one of the top vacuum cleaning equipment of the recent times and it is Roomba 860. Have a look at Roomba 860 review and know what it can do for you.

    If you went more just click hear : roomba 860 review

    ReplyDelete
    Replies
    1. very important for every electronics student
      https://goo.gl/zR1Juv

      Delete
  7. this link is very important for you
    https://goo.gl/zR1Juv

    ReplyDelete
    Replies
    1. Because there's all about electronics

      Delete
  8. Most home projectors provide multiple connection procedures. Learn about Top 10 Best Projectors Under $200 Dollars 2018 Reviews on pickup-world.com.

    ReplyDelete
  9. I Really like your post. Cambridge Heating and Cooling is one of the Best HVAC Company Providing Services in Ottawa and Toronto covering all areas of GTA.

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. When it has to do with buying projectors, a great deal of factors must be taken under consideration. Visit here for more details sparrow surf.

    ReplyDelete
  12. Here you will find best Latest Ghana music where you can download videos about culture lifestyle of nigerian people african citizens and much more. Thanks for visiting this website

    ReplyDelete
  13. bitcoin mobile recharge and top up credits quickly and easily any where in the world. this is a top up phone with bitcoin best telecom mobile network operator worldwide.Every thing we have explained is so simple to understand. We provide you 24 hours service. Many of our clients have actually fixed their bitcoin amount for their mobile credit. If you also do not use your cryptocurrency for any cause as yet then we have told you the best way to utilize your money

    ReplyDelete
  14. One of the top website for organic SEO, where you can easily Drive More Traffic To Website within a month. Yes, it's time to increase your clients/visitors on your website and earn more and more money from your website or business. Visit for more details.
    drive more traffic to website

    ReplyDelete
  15. Our offer is very effective when compared with the listed list. You create a very site and boost your google rankings web site, but this site does not require anyone to use your site. This is the first place for SEO services to allow users to access your site.

    ReplyDelete
  16. Buy Cell Phones & Accessories, Consumer Electronics TV, Video & Home Audio
    Vehicle Electronics & GPS Surveillance & Smart Home Electronics
    Home & Garden Kitchen, Dining & Bar, Tools & Workshop Equipment and more,
    Worldwide Shipping Available at http://www.ebaystores.com/todostuff

    ReplyDelete
  17. Excellent blog & I love your
    latest foreign Music you have a good work here... It's hard to find good quality writing like yours nowadays..
    Naija Entertainment
    Excellent blog & I love your
    latest naija Music

    ReplyDelete
  18. Thanks for sharing such an informative Blog with a fresh content. I really appreciate your work.
    Electrical Accessories Manufacturer in Tricity

    ReplyDelete
  19. https://operationalsmoke.blogspot.com/2016/12/wireless-temperature-sensor-nrf24l01.html?showComment=1570695707933#c3829907751139179005

    ReplyDelete
  20. visit now
    Xclusiveoffer gives 10% discounts on men fashion, kids fashion, online shopping , etc

    ReplyDelete
  21. I want to say thank you for this airtel cheat I will be checking this blog frequently for more mtn cheat do you guys also have glo cheat because i need more airtel free Browsing cheat

    ReplyDelete
  22. Are you looking for Courier in South East London? If yes, so you are in the right place. Speedy Sprint same day courier delivery service spans across London with Best package delivery in South East London Couriers . At Speedy Sprint, our top preference is providing an excellent service at a completing rate, all to do the necessary job of obtaining your Courier and Parcel Delivery Service has to be done as fast and headache-free as feasible so lets goodbye to searching South East London Courier near me

    ReplyDelete
  23. really detail content. glad to read this information. great writing. check our website to find electronics part muco.nl

    ReplyDelete
  24. Wao It's so good and very well detailed about wireless Sensor electricity consumption device

    ReplyDelete
  25. It is superb and awesome post about "Wireless Temperature Sensor (nrf24L01 & DS18B20)"

    Thanks,

    SBCGlobal Email Service Number

    ReplyDelete
  26. awesome post regarding "Wireless Temperature Sensor (nrf24L01 & DS18B20)"

    thanks,
    Gmail Technical Support Number USA

    ReplyDelete
  27. very awesome post. I feel that it's looks like complicated but very cool. this electronic tools can used in many area. thank you for sharing muco.nl

    ReplyDelete
  28. It is a great and awesome post regarding "Wireless Temperature Sensor (nrf24L01 & DS18B20)"

    thanks,

    Hotmail Helpline Number

    ReplyDelete
  29. nice post of "Wireless Temperature Sensor (nrf24L01 & DS18B20)"

    thanks

    Gmail Customer Care Number

    ReplyDelete
  30. Thank you so much for taking the time to share such a nice information cash for cars robina cash for cars gold coast

    ReplyDelete
  31. New Sony OLED Monitor , New 17" and 25" OLED from Sony

    The 25″ OLED is currently being exhibited at the HPA Technology Retreat along side a CRT and a LCD monitor. The demo consisted predominately of photos, making it impossible to measure motion blur and response times.

    ReplyDelete
  32. Thanks for the nice blog. It was very useful for me. Keep sharing such ideas in the future as well.
    E-waste recycling solution

    ReplyDelete
  33. I have perused your Post; it is exceptionally useful for me. What’s more, I need to express profound gratitude to you.
    E-waste recycling in Kolkata
    E-waste recycling in Vishakhapatnam

    ReplyDelete
  34. Nice post and it's very informative too. Thanks for sharing and you can also check e waste management

    ReplyDelete
  35. Thanks a lot for sharing this informative and useful guide from NIHORT Recruitment Form Portal 2020

    ReplyDelete
  36. Nice post and good information on wireless temperature sensor. Thanks for sharing and you can also check waste management recycling and recycled products.

    ReplyDelete
  37. I saw this very good post of yours and I liked it very much, I do not know how to praise it, I would just like to say that this post is one of the posts that I like very much and I am very happy to see these posts.
    escort service gurugram
    call girl gurugram
    Gurugram Escorts
    Gurugram escorts

    ReplyDelete
  38. If I see a good post, you will not go without praising me, because every word written in the post you have written is very thoughtful, your way of writing is very beautiful and your views are also very good. This is a commendable post, as much as this post is praised, it is less, you should keep writing more beautiful posts in your life.
    Gurugram Sector 39 Escorts
    cheap escorts services in Gurugram
    call girl sector 24
    Sushant lok Escorts

    ReplyDelete
  39. When I am alone, I come to see your comments. It is a very good comment, how strange is your loneliness in this city, there are thousands of people but no one is like that. One is changed because you are not there, yesterday even the sunlight did not come on the wall. Thank you from my heart.
    independent gurugram call girls
    best call girl gurugram
    golden opportunity
    independent call girls in gurugram
    call girl agency
    escorts service gurgaon
    Call girl gurugram

    ReplyDelete
  40. Need an hacker for hire? need to keep an eye on your spouse by gaining access to their emails?, want to know what your kids do on social networks? Whatever it is, Ranging from Bank Jobs, Flipping cash,Taxes. He can get the job done. Are you looking for help hacking into social media? change of grades? help with projects management hacking, social media hacking- Contact him via: (hackingsetting50@gmail.com)

    ReplyDelete
  41. bedroom furniture in pakistan
    furniture companies in pakistan
    furniture in lahore
    We give multi-home contraptions to our huge client to Save gigantic and get the best expenses on our organizations to get our things. Excessively empowered give LED TV, Washing Machine, Geyser, AC, Fridge, Lights, Switches, Furniture, Wardrobe, Floor Tiles, Bathroom Tiles, Steel quick movement | 100% genuine | Great worth.

    ReplyDelete
  42. This comment has been removed by the author.

    ReplyDelete
  43. I appreciate your article. You truly share relevant and extraordinary knowledge. Thank you for keep sharing these valuable thoughts.

    T3AS ADMIN PWR SUP MOD - APPLIED DIGITAL ACCESS
    T3AS ADMIN PROCR MOD - JDS UNIPHASE
    T3AS ADMIN PROCR-2 MOD - APPLIED DIGITAL ACCESS

    ReplyDelete
  44. JISElectric is one of the leading manufacturers and suppliers of low voltage switchgear in Dubai, UAE. We are leading contractor low voltage circuit breakers, switches, off load electrical isolators, HRC fuses, earth leakage circuit breaker, miniature circuit breakers (MCB) and Molded case circuit breakers (MCCB) in Dubai.

    Switchgear Manufacturing Companies in UAE

    ReplyDelete
  45. I read your whole content it’s really interesting and attracting for new reader.
    Thanks for sharing the information with us.Please visit...

    ReplyDelete
  46. The article is much information which I was searching for. Nice intro good explanation thanks for sharing.
    pilot light

    ReplyDelete
  47. Thanks for Sharing!!

    Illini Foundry, we are proud to be a leading provider of ferrous and non-ferrous foundries services. Our team of experienced professionals has the skills and expertise necessary to deliver high-quality products to customers in various industries, from agriculture and automotive to construction and defense. For more information, visit the website!!

    ReplyDelete
  48. Thanks for Sharing!!

    George Stevens Manufacturing designs and manufactures high-quality transformer coil winding machines. Our machines are designed to wind coils with precision and consistency, ensuring optimal performance of the transformers they are used in. Our transformer coil winding machines are built to last and are equipped with advanced features that make them easy to operate and maintain. Visit the website!!

    ReplyDelete
  49. https://onlineelectronickits.blogspot.com/2015/05/genuine-arduino-this-board-comes-from.html?sc=1726575864928#c5255430733981763713

    ReplyDelete