Internet button on ESP32, Google IoT Core and Mongoose OS in 5 minutes



in this video I'm going to show how to create internet button with Google IOT core ESP 32 and Mongoose OS we need to have three things done before first download install and configure Google Cloud SDK you have to have a g-cloud command set up on your computer second go to Mongoose – is calm and install mos2 third get an ESP 32 development board like this one here I have expressive deaf cat seaboard and connect it to your computer go to Mongoose – RS comm click on developers documentation and open Google IOT core documentation page g-cloud component installed better ok have them installed second authenticate with Google Cloud choose user click allow okay we are authenticated next create your project so you have to choose a unique project name for yourself but I have one already created it's called – Santa – 2015 ok continue next command attaches the policy to my project ok done next setup default project name ok done create pop subtopic ok create subscription ok and create device registry done now type MOS to start mongoose OS web UI here we go choose serial port click select choose ESB 32 and demo – Jas app click on a flash that installs JavaScript enabled firmware ok the cameras flash now configure Wi-Fi enter network name and the password click on set my devices online now click on done go back to the instructions copy the last command click on terminal tab and paste this command here changed project name and press enter so this last command provisions the device to Google IOT core now let me switch to the Google IOT core console what I see here is a device registry that I've created earlier click on iot registry and here I have my device Google IOT core defines 2 special and ktt topics for each device they're called config and state the state topic keeps the device state and conflict topic keeps the device configuration switch back to the console click on edit registry and choose a device state topic click update now go back to the device code and change the topic to state so on the button press we will be publishing a message to the state topic click this button to upload this file to the device wait until it's connected and click on a button we see published messages here to the state topic switch back to the console click on a device ID and click on configuration and state history now when I press a button again and refresh this page I can see how my messages appear here click on the last one choose text so you can see the message with the free RAM and total RAM numbers so this shows how you can send information from the device to the Google IOT core now let me show you the other way around how can you push data from the Google i/o T core to the device go to JavaScript code and a few lines MQTT subscribe to the config topic so let's change the topic name to the configuration topic so the last tube it would be config ok and in this handler what we're going to do is just print the configuration that we have received nothing else so click on this button to upload this file and switch back to the Google IOT console back to the device details and click on update config and here enters simple JSON structure a 1 2 3 click send to device and go back to the device we can see this message appear to summarize in this video I've shown how you can send data from the device to the Google IOT core and the other way around thanks for watching

5 Comments

  1. tinymahesh said:

    good to note is that gcloud *must be installed and run* on your local computer. using it within google's gcp control panel in the browser is NOT the same. this is not obvious to a newbie and took me over 2 hours to figure out.

    July 19, 2019
    Reply
  2. Roman Kolbert said:

    The demo-js changed since that video. Is the code still somewhere? Also google iot core is not beta anymore.

    July 19, 2019
    Reply
  3. Dainius Jankauskas said:

    well i was following all steps and i am getting error : Server Error: {"error":"gcloud device create: : exec: "gcloud": executable file not found in %PATH%"} after i paste this command to device console mos gcp-iot-setup –gcp-project YOUR_PROJECT_ID –gcp-region europe-west1 –gcp-registry iot-registry. what i did wrong any suggestions ? 🙂 and yes i got my project id.

    July 19, 2019
    Reply
  4. Thoại Triều Ngô said:

    I took me months to find out a very better way to deal with these devices, every cool video about Google Cloud IoT Core! Now I'm level up!

    July 19, 2019
    Reply
  5. rykubot said:

    I could not get my button to publish on to IoT core. Did you have to setup the MQTT server?

    July 19, 2019
    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *