AWS IoT Template

Posted on
  • Hello all,

    I'm curious if anyone has attempted and/or has any suggestions for how to go about building a template to connect with AWS' IoT service. Ideally it would look something like this:

    // main.js
    
    const WIFI_SSID  = "WIFI SSID"
    const WIFI_PASS  = "WIFI 
    ...
    
    //config.js
    const AWS_IOT_MQTT_HOST  = "something.amazonaws.com"
    const AWS_IOT_MQTT_PORT  = 8883
    const AWS_IOT_MQTT_CLIENT_ID  =  "SomeClientID"
    const AWS_IOT_MY_THING_NAME   =  "SomeThingName"
    

    And you'd store some AWS provided certs that will be given to you by amazon.

    I've used this repo as example on how to implement it. As a strategy I'm thinking:

    1. Implement the C version from the repo above.
    2. Then try to implement it using the official espruino board. I think I'm more likely to get support doing this.
    3. Implementing it using the ESP32 with espruino.

    I'm also curious if anyone has attempted this in the past with any board.

    Thanks for reading!

  • I think someone did manage this - it's a secure connection though so you need TLS support. Realistically that means Espruino Pico or WiFi, but I just checked and it does seem to be compiled in to ESP32, so it might possibly work?

  • Awesome! I'll get the Espruino WiFi and see if I can get that going. I'll post my progress on here.

  • hello Gordon and user80424
    Is there any example or tutorial of how to connect Esrpuino wifi to AWS IOT.
    This could be huge for Espruino/javascript enthusiasts if we can get espruino to connect and work with AWS IOT.
    Thanks

  • There's two ways I'm thinking. Hopefully, I'm successful with the first.

    1. Port the sdk to the espruino lib instead of the standard js lib. If I can get the standard methods and dependencies, I think this is the way to go.

    2. If that doesn't work, I can write an extension in C.

  • hi user80424,
    #1 definitely sounds the way to go. I apologize but I am not sure what "standard methods and dependencies" means?
    The AWS library is licensed under Apache 2.0 license so I am assuming it should all be available.
    What could I do to help?
    I think it will be huge because there are tons of people who know JS and would jump into embedded stuff if the easy tutorials/blogs/examples are available.
    If we can get this to work with AWS I would love to write a step by step guide for setting it up.
    Best

  • Hi @user83752,
    By "standard methods and dependencies" I mean that I can find or write an equivalent function for espruino.

    For example on line 60 of index.js on the device sdk , you'll see that crypto.HmacSHA256 is called.

    That relies on the 'crypto-js' package (dependency). Instead of calling that, I can call the espruino HMAC module

    @Gordon please tell me if my thinking is correct on this.

    @user83752 I'll create a repo you can clone to test or do a pr. Its not going to be soon, cause I got other work stuff. But I'll post it here when its ready.

    Thanks

  • 👍

  • @user80424 yes, that sounds like it'd be fine to me. In fact you might find that the bog standard crypto SHA256 does what you want - without the HMAC library: http://www.espruino.com/Reference#l_crypto_SHA256

  • Happy Holidays folks. I am hoping this will be my new years gift :)

  • hello @user80424 and @Gordon
    Just checking in to see if there is any update.
    Thanks

  • Just bumping this in case anyone made any progress?
    I'm hoping to use with with either a Puck (and some sort of BLE<>IP bridge) or an Esprunio WiFi

  • No news on that... However looking at it a good way to plumb in Bluetooth devcies would be to:

    Then plumbing it all together should be trivial in Node-RED

  • Thanks,

    Yeah I've marked the node-red hub to look at as I've been doing a load of development with NR recently so thats something to play with :)

    The intended use for the AWS-IoT though won't really make Puck&Pi a go-er for production use, might be fine for a quick prototype

  • Two years since the discussion came up; is there anything technically known that would prevent use of the ESPruino Wifi to connect to, and exchange data with AWS ? Seems to me the basic stuff is in the ESPruino, it can go through any Wifi router it can connect to for Internet access.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

AWS IoT Template

Posted by Avatar for user80424 @user80424

Actions