#138

Поділитися
Вставка
  • Опубліковано 12 гру 2024
  • Internet of Things (IoT) using an ESP8266 (Thingspeak Live Demo)
    Upload data to The Cloud very easily using any ESP8266 board and my sketch.
    Celebrate Arduino Day, Saturday 16th March 2019!
    This description and further resources available in my GitHub:
    github.com/Ral...
    I need to upload some data to the "The Cloud" as part of a project I'm working on, so I thought I'd share the way I'm sending the data using a secure (SSL) mechanism to protect from prying eyes (or worse).
    It's all very straightforward using an ESP8266 of some sort (even a tiny ESP8266-01 if you have just data to upload) and the change in data is reflected pretty much in real time.
    There are graphs and widgets and you can even see all the data on your phone without doing a thing (OK, you have to install an app).
    There's a lot more I need to do with this project so stay tuned for further updates!
    =============================================
    LINKS LINKS LINKS LINKS LINKS
    =============================================
    (Some of these links may be affiliate links and can help my channel at no cost to you)
    ESP8266.h WiFi library (complete) on my GitHub
    (just so you have the same version as used in the demo):
    See github.com/Ral...
    Thingspeak IoT platform with analytics:
    thingspeak.com/
    The Thingspeak library:
    github.com/mat...
    ESP8266 D1 Mini as shown in the video:
    www.banggood.c...
    Interesting kit for the Wemos D1 Mini:
    www.banggood.c...
    ESP8266 D1 mini OLED shield (small but good for simple messages etc):
    www.banggood.c...
    WEMOS D1 ESP8266 (Arduino UNO sized) board (cheap but good, what I used in the video):
    www.banggood.c...
    ---
    If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite journey
    My channel and blog are here:
    ------------------------------------------------------------------
    / ralphbacon
    ralphbacon.blog
    ------------------------------------------------------------------

КОМЕНТАРІ • 74

  • @daveholden3935
    @daveholden3935 5 років тому +7

    Appreciate your time and hard work putting this video together - and the clarity of presenting the processes involved setting up communications. Would be interested knowing what additional practical applications you (and others) will use this for.- temperature, water level, you mentioned. Any interfacing hints/tips/gotchas.

    • @RalphBacon
      @RalphBacon  5 років тому

      I'll probably copy and paste this answer a few times, Dave.
      The way I see this being of use is when you don't want to log locally (eg on an SD card) and/or you need to share the information with others. So, if you are tracking the temperature and humidity in a greenhouse it might be useful to see that information on your phone at a glance rather than have to troop down to the actual greenhouse and get out the SD card, put it into your PC... etc! On the same (contrived) example, the gardener can see the information on his own phone and waters a bit more (or less) depending on what the information shows him. Yeah, I know, not many people have gardeners but it just demonstrates the sharing of data principle.
      And I haven't (yet) shown an example where the data can be downloaded to your PC where you can slice and dice the data all without having to leave your warm home office! No SD card required!

    • @bassome3000ify
      @bassome3000ify 5 років тому

      Yeah thanks 💪

  • @williammiller7543
    @williammiller7543 5 років тому +1

    Once again, GREAT video. I have used ThingSpeak in the past and appreciate you showing how to make it secure. Please keep up along this topic.

    • @RalphBacon
      @RalphBacon  5 років тому

      I have a few things to show you all, William, as my project progresses. And all involve being secure on the Internet. It's important in this day and age that our data remains private.

  • @whitefields5595
    @whitefields5595 5 років тому

    Ralph, This is you at your best. Far better than when you mess with the mains. You are released from the Naughty Step

    • @RalphBacon
      @RalphBacon  5 років тому

      I had cramp in my legs for many weeks now. I'm glad to be off that Naughty Step. However, I will be doing another video involving mains soon(ish) so I won't move too far away from it... it's my second home. I'm glad you liked _this_ video though!

  • @robertgrassi6285
    @robertgrassi6285 5 років тому +1

    Clear, detailed, natural teacher, nice video thanks for sharing

    • @RalphBacon
      @RalphBacon  5 років тому

      Thanks, Robert, nice to hear from you.

  • @isoguy.
    @isoguy. 5 років тому +3

    Awsome, would love to see a video of you developing your own app to display data on a web page.
    Thanks for sharing

    • @RalphBacon
      @RalphBacon  5 років тому +2

      I hope to do this as part of my project, although it might be a phone app. I've not really finalised my thoughts on this part of my project yet.

    • @isoguy.
      @isoguy. 5 років тому

      @@RalphBacon thats cool, i look forward to the project

  • @gpTeacher
    @gpTeacher 5 років тому

    Terrific as always Ralph. My next Thingspeak (or more likely Blynk) project is to create an IOT app that tells my esp8266 to poll the house temperature and then to activate a servo to press the ON button for my air conditioner remote so the house is cool when I get home from work. (But not before late June😎😎) these new tools for supporting IOT development are great! Thanks again Ralph! You’re an inspiration! Gord

    • @RalphBacon
      @RalphBacon  5 років тому

      Well, getting your ESP8266 to monitor and record the temperature of your house is step 1, so good luck with that, Gord.
      Have you considered using MQTT, Node-Red and a Raspberry Pi to do this? If the ON button of your air conditioner is a simple two pole switch then a Sonoff 4-channel unit would work really well too (I demoed mine, very briefly, using Alexa, in video #109 for my workshop heater automation). Good further Home Automation reading is from Peter Scargill: tech.scargill.net/

  • @dikl2689
    @dikl2689 5 років тому +1

    Do you have a reason for wanting the information in the 'cloud'? I have done a similar thing but use MQTT and Node-Red to write to a local database and use Grafana to graph the data. All running on a Raspberry Pi. This will carry on running whereas you might lose functionality in the event of losing network connection.

    • @RalphBacon
      @RalphBacon  5 років тому

      I have a real requirement to have my data online, Dik, namely it must be available to disparate parties in different countries. Obviously, it won't be my greenhouse temperature that I'll be sharing but something more critical to those involved.
      But losing network connectivity (local wifi, Internet, remote server) is all very real, I will have to ensure I take that into account in my upload coding, so thanks for bringing that up, good point!

  • @gfodale
    @gfodale 4 роки тому

    @ 1:21, Is this a trick question? I mean, the secure connection would be number 5, but is there really a 'secure manner' when Google is involved?

    • @RalphBacon
      @RalphBacon  4 роки тому

      It is indeed answer #5 and yes, it really is secure even if Google is transporting the data. End to end encryption.

    • @gfodale
      @gfodale 4 роки тому

      @@RalphBacon I was more referring as to once they've got their hands on data. They don't strike me as 'pillars of the community' types. More sarcastic humor as such.
      Also, I hope this is an indication you're getting back on your feet. Good to have you back if that is the case.

  • @martinbriselden7450
    @martinbriselden7450 5 років тому

    I think that it's brillinant that you actually managed to get eclipse running on your PC!!

    • @martinbriselden7450
      @martinbriselden7450 5 років тому

      *Brilliant

    • @RalphBacon
      @RalphBacon  5 років тому

      It wasn't Eclipse that was the problem, that's been running for years. It was getting it to talk nicely to the ESP8266 with all the variants that was a real drag!

  • @andymouse
    @andymouse 5 років тому

    Hi, been playing with this myself using "Blynk" and also "Particle" but to be honest, struggled to think of a real life application for me. I look forward to seeing what you have in mind and maybe picking up some ideas and thoughts from you and the other commentators.

    • @RalphBacon
      @RalphBacon  5 років тому

      I'm not going to divulge my project's intention just yet so I'll repeat the example I gave to Dave below:
      The way I see this being of use is when you don't want to log locally (eg on an SD card) and/or you need to share the information with others. So, if you are tracking the temperature and humidity in a greenhouse it might be useful to see that information on your phone at a glance rather than have to troop down to the actual greenhouse and get out the SD card, put it into your PC... etc! On the same (contrived) example, the gardener can see the information on his own phone and waters a bit more (or less) depending on what the information shows him. Yeah, I know, not many people have gardeners but it just demonstrates the sharing of data principle.
      And I haven't (yet) shown an example where the data can be downloaded to your PC where you can slice and dice the data all without having to leave your warm home office! No SD card required!

  • @OtusAsio
    @OtusAsio 5 років тому

    Thank you again... all is well explain and documented. BTW, hard work got me late in the sending of the promised things, it will come (worst than from china maybe). I always enjoy your videos, and expecting the next...

    • @RalphBacon
      @RalphBacon  5 років тому +1

      Ha ha, China sends stuff out really quickly these days, Pierre. I was reading that AliExpress (and therefore Bangood too, I suspect) have a "special arrangement" with the British Post Office and get stuff here within two weeks. I've even had it quicker than that! But no worries, when things turn up, they turn up, but work comes first.

    • @DavidUnderhill
      @DavidUnderhill 5 років тому

      @@RalphBacon I am getting average of 9 days for some Chinese eBay resellers to Aust. It takes average of 2 weeks for stuff from Aust. suppliers (I think some are actually dropshippers from asia).

  • @gavinsmalley1513
    @gavinsmalley1513 5 років тому

    Great video as always Mr B.
    The only problem with https on the esp8266/32 is that you have to revisit and re-upload your code every time the remote site renews it's certificate.
    Yes you can use a locally hosted config portal and store it in SPIFFS but it still stops working every time the renew their cert.
    Removing the fingerprint check still ensures encryption but, of course, leaves open the chance of landing on the wrong site unknowingly.
    I have a plan for my yet unbuilt IoT to all report to a local RasPi running Mosquitto MQTT and then to use Node Red to "bounce" messages/data I want on the internet to Thingspeak. No need for TLS inside the home and then only the RasPi is communicating over TLS and that will always have up to date root cas.
    Otherwise it could be a lot of work (depending on how many ESPs) to update all the fingerprints.

    • @RalphBacon
      @RalphBacon  5 років тому

      Certificates changing (every two years, but that could mean next week) could be an issue, you are correct Gavin but I have "a plan"!
      Assuming I consider it worthwhile to include the fingerprint check in my final project I'd store that on an SD card that could be edited by any text editor. I have other stuff to go onto the SD card, including WiFi details, email addresses and no doubt other things too. But, as you correctly state, if I connect "blindly" using TLS without the thumbprint at least the data is still encrypted. As I'm only sending data the risk is going to be very low.
      I didn't want to use a Pi for this project; when I show you the final idea you will see it's just not worth it! KISS as they say.

  • @grahamjohnston2658
    @grahamjohnston2658 3 роки тому

    Hi Ralph, just trying your #138 Thingspeak program and I get the following compile error:
    ThingSpeeak_files:113:10: error: 'class axTLS::WiFiClientSecure' has no member named 'setFingerprint'
    client.setFingerprint("271892dda426c30709b97ae6c521b95b48f716e1"); //Set by gaj 19/1/21
    I copied the file that you used from github and put it into a new tab in IDE. I assume that's ok.
    cheers
    gaj

    • @grahamjohnston2658
      @grahamjohnston2658 3 роки тому

      Just revisited this having done a google search for the error shown above. I copied the 'fix' and it works. Turns out that this project requires the latest ESP8266 version. I had been using 2.4.2 as suggested for your Gmail project. I am now able to see a graph! Yippeee!!

    • @RalphBacon
      @RalphBacon  3 роки тому +1

      Good news, Graham, always a great moment when things work.

  • @jpthedelawarebeeman6239
    @jpthedelawarebeeman6239 5 років тому

    Hi Ralph can you please help a newbie get my thermistor to write in Fahrenheit to ThingSpeak. I have it working with the random data from A0 now if I can only get data from my Thermistor on A0 to upload I'd be set thank you for any help. I want to set this up to monitor the temperature in my beehives.

    • @RalphBacon
      @RalphBacon  5 років тому +1

      So I've finally found someone who really is measuring a beehive temperature? Fantastic! OK, what are you using to get the temperature? A thermistor, but have you got the make, model and so on?
      Frankly, for a newbie I'd be more included to use an SPI or I2C device that gives you back the actual temperature without any conversion or math involved. So a DS18B20, for example, or a DHT22. The DHT22 gives you humidity as well as temperature, and there is a library for it to make communication with it very easy. I use one for Benny's cat run.
      Let me know whether you want to proceed with the thermistor (I need the info on this) or switch to the DHT22 device!

    • @jpthedelawarebeeman6239
      @jpthedelawarebeeman6239 5 років тому

      @@RalphBacon Hi Ralph thank you for getting back to me. I am using a 10K NTC Thermistor with a D1 Mini. I think I have it working. Do you have any code working for a DHT11/DHT22 and D1 mini for ThinkSpeak to sample data every hour ? I can tell if my bees are alive through winter watching the Temperatures or so I hope.

    • @RalphBacon
      @RalphBacon  5 років тому +1

      You need to scan my videos (and GitHub) for references to my Home Alone project. I posted all the code in my GitHub including the ThingSpeak code. I use a JSON library to download the data but you might not need to - there is a great free app for Android devices called "IoT ThingSpeak Monitor" (it's a widget) with Real Time view of the ThingSpeak data. I demo this somewhere, too. I have two instances of this on my phone to monitor my mum's apartment.
      For the DHT22 code search for Benny Cat Run Rain Alarm, works well.

    • @jpthedelawarebeeman6239
      @jpthedelawarebeeman6239 5 років тому

      Hi Ralph - Thank you I may have found one on the internet that works in Fahrenheit. I am not sure who the author is but thank you.

  • @omaoda4462
    @omaoda4462 5 років тому

    Great video again, thank you very much, I really enjoy your videos. I am planing to do some CAN-Bus self-made home automation with arduino (or so). Are u doing or planing something with CAN-Bus or Smart-home? I would love to get an introduction by you. :-) Best Greetings and keep on doing videos.

    • @RalphBacon
      @RalphBacon  5 років тому +1

      I'm not planning on using the CAN bus (usually reserved for vehicles) but Home Automation using MQTT, Node-Red and a Raspberry Pi has been on my to-do list for over a year now - it just takes some time to get it installed (and understood).
      In the meantime, I highly recommend Peter Scargill's site who describes all this in the great detail (and he does UA-cam videos too): tech.scargill.net/

  • @Ed19601
    @Ed19601 5 років тому

    Was using Thingspeak for a long time, but at a certain moment I had to renew my 'licence' and though it should be possible....I have not been able to renew it without being presented with a bill of I think 75 pounds, so I just left it. Maybe I just have to take a new channel.
    Anyway, it is also possible to upload data to Thingspeak via mqtt.
    You don't HAVE to put your config.h file in the sketch folder, you can just put it in its own folder in the library folder and call it the same as you would any library with

    • @RalphBacon
      @RalphBacon  5 років тому

      I'm using the free version which gives me 3 million messages a year (daily max of 8,219), and 4 channels. I'm hoping that will suffice for my meagre hobby needs to be honest as the next level up (home) is £65 per year, probably plus VAT. Yes, try setting up a new (free) account, Ed, and see what happens.

  • @hansdegroot652
    @hansdegroot652 2 роки тому

    Isnt ssl depricated and now tls?

    • @RalphBacon
      @RalphBacon  2 роки тому

      Probably, but to get any kind of encryption on these devices would be a good thing.

  • @lodesmets9815
    @lodesmets9815 5 років тому

    Great explanation (as always). But those certificates change every x months? (or am I wrong).

    • @RalphBacon
      @RalphBacon  5 років тому +1

      SSL certs usually last two years, and certainly do change. Which is why in my actual home project I will be putting such thumbprint information on an SD card that can be edited with a PC and put back, press RST and voila! All working again.

    • @MarkRead04
      @MarkRead04 5 років тому

      Would have liked to have seen the step where you use Chrome (or whatever) to view the thumbprint for any domain (thingspeak in this case). I've just subscribed to your channel as i've a passing interest in this tech and liked your presentation/communication style.

  • @nickpelov
    @nickpelov Рік тому

    You forgot to mention that the site certificate updates every now and again (4 months to an year). When this happens you'll have to update your fingerprint

    • @RalphBacon
      @RalphBacon  Рік тому

      If you use a secure protocol, for sure. One of the downsides of https: but I hear the ESP32 can download new (root) certificates pretty much automatically these days. Something I mean to explore.

    • @nickpelov
      @nickpelov Рік тому

      @@RalphBacon that would be something I'd like to see - Make sure you add HTTPS and SSL to the title so I don't miss it. I used CA certificate before to check authenticity of remote site, but if I wanted the CA Cert up to date I had to update it manually or at least with a script. But that's fixed to a single CA. If esp32 can handle all root certs automatically it would be nice. But won't that require too much disk space/ram? 0.5MB disk space should be enough for root certs and if they are in binary - even less. But sometimes you get 100k free ram (if you leave 100-120k for your app).

    • @RalphBacon
      @RalphBacon  Рік тому

      @Nikolay I will bear that in mind should I get round to doing this!

    • @nickpelov
      @nickpelov Рік тому

      @@RalphBacon Btw you know that you don't need https to have secure data transmission. Well if you have your own web server. You can calculate a hash of your data + secret key and the data integrity can be guaranteed (if the data is not secret - you won't care if someone knows the temperature of your home, or solar panel voltage). ESP32 has hardware sha256 built in. Of course you need your own web server. I don't think anyone supports this. May be I can make a website that allows less complex secure data collection using hash signature.

  • @JasonChurch1992
    @JasonChurch1992 5 років тому

    Link to your GitHub is 404... Can you update, please?

    • @RalphBacon
      @RalphBacon  5 років тому

      Oh, should be github.com/RalphBacon/IOT-ESP8266-Internet-of-Things - I shall check what I wrote in my video description, thanks for alerting me, Jason.

  • @OsoPolarClone
    @OsoPolarClone 5 років тому

    Great video again!

    • @RalphBacon
      @RalphBacon  5 років тому +1

      Glad you liked it Bruce, nice to hear from you.

  • @avejst
    @avejst 5 років тому

    Nice project
    Thanks for sharing😀👍

    • @RalphBacon
      @RalphBacon  5 років тому

      Glad you liked it, Asger, thanks for posting.

  • @CrazyCoupleDIY
    @CrazyCoupleDIY 5 років тому

    Well done

    • @RalphBacon
      @RalphBacon  5 років тому

      Thanks, CrazyCouple, could be useful so someone.

  • @pauldusa
    @pauldusa 5 років тому

    I added you on my FB,, I also included a word about you as a Title,, > He is a builder too,, same as me ,, Good guy, many great video's

    • @RalphBacon
      @RalphBacon  5 років тому

      Very kind of your Dr Paul, most appreciated! Glad you like the videos, keep watching!

  • @MrEdwardhartmann
    @MrEdwardhartmann 5 років тому +1

    good job

    • @RalphBacon
      @RalphBacon  5 років тому

      Thanks Edward, hope you enjoyed it!

  • @svengaefgen5909
    @svengaefgen5909 5 років тому

    12:22 Instead of the #ifdef stuff you could use #pragma once. en.wikipedia.org/wiki/Pragma_once

    • @RalphBacon
      @RalphBacon  5 років тому

      Yes, the _#pragma__ once_ is better than using #ifndef but in this case the file was generated for me by Eclipse so I just left it. It will be worth mentioning the use of _#pragma__ once_ so thanks for the nudge.

  • @pavankumar-ff9bo8zc5y
    @pavankumar-ff9bo8zc5y 5 років тому

    Thank you!!!

    • @RalphBacon
      @RalphBacon  5 років тому

      You are most welcome Pavan Kumar, I'm glad you like the videos. Nice to hear from you.

  • @hansdegroot652
    @hansdegroot652 2 роки тому

    Arduino day lol😀i think i missed it.

    • @RalphBacon
      @RalphBacon  2 роки тому +1

      Next year it will come around again, I'm sure. Be ready!

    • @hansdegroot652
      @hansdegroot652 2 роки тому

      @@RalphBacon i am always ready. Just never at the right time😁

  • @lezbriddon
    @lezbriddon 5 років тому +1

    I really really hate the IOT, its not ''yours'', i'm not worried about security, but when theres no internet, theres no things... home automation should run completely within the home, then its secure by nature, the clue is in the name...
    call me an old timer etc but the world is becoming too reliant on sending packets of data 5000 miles around the country to end up 8ft away......

    • @Debraj1978
      @Debraj1978 5 років тому

      Totally agree, in my opinion, home automation should work on separate physical medium (433MHz RF or power line or CAN bus) and only connection with outer world through internet should be, if you need any remote control (switching power at home, from office).

    • @RalphBacon
      @RalphBacon  5 років тому

      Except in my case, Lez, in my project, the packets will be sent several hundred miles away so at least 3-6 parties can monitor the data, wherever they may be (usually in Europe). The data I'm sending out, whilst of a personal nature, is of not use to anyone else - it's not my bank details!
      On the other hand, my Home Automation project will be sending the data nowhere except to my local Raspberry Pi via MQTT so I guess that's what you mean. Sometimes, though, it really is useful to send data to "the Cloud" so that it is remotely available.

    • @whitefields5595
      @whitefields5595 5 років тому

      lez briddon Les, what do you use to interface you smart phone or tablet to your WiFi and keep it in the home. I want to get my IPhone 6 to talk to my ESP8266 or similar and would like to know how you went about it