Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. rakeshpai
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    rakeshpai

    @rakeshpai

    30
    Reputation
    70
    Posts
    853
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    rakeshpai Follow

    Best posts made by rakeshpai

    • Browser-based firmware generator

      Disclaimer: This is a proof-of-concept. It doesn't work. Things will change, and will break. In fact, I'm sure many things are broken right now. It would be pretty stupid to use this for anything important. I'm just putting this in the public to gauge interest. You have been warned.

      Link to the firmware generator.

      If you are like me, you want to put approximately half a million MySensors nodes around the house. You've probably already built the first few nodes, so it feels like you are most of the way there. You love the soldering and the building. However, the coding isn't exactly fun. It requires reading through docs, then trying and failing, and rinse and repeat until you get it right.

      This tool doesn't solve that problem yet, but it aims to. It aims to provide a simple browser-based UI for configuring your network, and then generating the firmware for the node automatically, using whatever's the best-practice for writing the firmware. This tool writes your code for you!

      The good:

      • You don't have to write code! This web page does it for you!
      • Security built in by default.
      • Uses the awesome NodeManager by @user2684 under the hood.
      • The web-page, once loaded, works completely offline. You do not need an Internet connection to use this tool! (Try it!)
      • No sign up, no registration. In fact, there's no server, or no central database. Your data doesn't even leave your browser.
      • There's no server, so there's no network communication and everything's local, so it's blazing fast!
      • That bears repeating: The firmware is generated inside your browser, without using any cloud that will rain down on you. Isn't it awesome what browsers can do these days?

      The bad:

      • Needs a pretty modern browser. Tested on Chrome and Firefox. Untested on IE.
      • Doesn't work on mobile devices (yet). Might work in Chrome/Android, but it's untested. Other browsers would need a server-side component to get them to behave.
      • I have Google Analytics on the site, just to gawk at some graphs. All GA data is anonymous.

      The ugly:

      • Well, it looks ugly.
      • The code it generates hasn't been tested. This is just a proof of concept. DO NOT depend on this.
      • The code, especially the security bits, require review. In fact, I'm pretty sure I've done it wrong.
      • They say, 'if you aren't ashamed of it, you've released too late'. I'm definitely releasing too early.

      With that summary out of the way, I'd love it if you could poke around and let me know what you think. You don't need to download or install anything - it's just a web page - so just click the link above. I'm trying to gauge interest in the community for this, to decide if it's worth pursuing.

      Would you like me to spend time on making this better?

      The icon to download firmware is on the top-right of the page, and you can see it on the pages for either the nodes you create, or on the page for the gateway. You can create nodes by selecting your network in the left hand side navigation, and clicking on the + icon at the top right of the page.

      The firmware is downloaded as a zip, which contains a SecurityPersonalizer with your security settings, and the main sketch which runs on your node. Currently, the firmware might not even compile.

      Hope this gives an idea of what I have in mind, even if it doesn't actually work.

      All manner of suggestions and feedback is welcome.

      posted in Development
      rakeshpai
      rakeshpai
    • Node.js module to talk to the gateway

      Long time lurker, first time poster.

      I've implemented a node.js module which you can include in your node projects, that does the dirty work of communicating with the serial gateway, and exposes a (hopefully) simple API to interact with your mysensors network.

      Find the project on Github or NPM.

      I've tried this with a Serial gateway, and it works fine. I haven't been able to test it with a Ethernet / WiFi gateway, but it should work fine with them as well.

      Please feel free to use this in your code, if you like, and let me know if you have any suggestions/feedback (or post an issue on Github).

      posted in Development
      rakeshpai
      rakeshpai
    • RE: Browser-based firmware generator

      I just discovered this: https://github.com/arduino/arduino-create-agent

      It's a project by the folks at Arduino, so it's as official as it gets. It's an app that you run locally, that runs in the background, puts an icon in the system tray, and starts a WebSocket server, with which a browser can connect to the local USB devices. It looks like it has been built for the Arduino Web Editor, and is in more-or-less active development.

      I just spent under 15 mins with it, and I was able to talk to it from a CLI tool over websockets, and get it to list the available serial ports successfully. This is very encouraging.

      Does anyone have any opinion about / experience with this? They have binaries for the three big desktop OSs. It's written in Go, so it's very clean in terms of deployment - it's just a single binary with no dependencies.

      It looks like they enforce security by having a config.ini file with a list of allowed origins (domains) that are allowed to access the local web server. Since our page is running over HTTPS, the browser also imposes a restriction that it won't connect to insecure origins, which these chaps circumvent by creating a certificate locally during install (a process that I don't completely understand yet).

      So, if someone is to use this, they'll have to install the app based on their platform, then modify config.ini to give access to this URL. That's relatively easy to do. It gives us access to everything that Arduino can do, but from a browser.

      Most importantly, it's an official project by the folks at Arduino, so it can be trusted. Also, we don't have to replicate this work, and simply build on top of their APIs.

      Thoughts?

      posted in Development
      rakeshpai
      rakeshpai
    • RE: Browser-based firmware generator

      @user2684 Thanks for the update. Much appreciated.

      The thing is, I think it'll be really great if this project can come to a point where I can confidently tell people that they can flash the output code to their devices, at least in a test setup, so that I can start to get some usage-based feedback. So far, I've very vocally said that the output isn't ready, and that's definitely limiting usage.

      So, I wouldn't say it's urgent, but user-feedback is important, so I'd like to start making releases that I can ask people to try.

      posted in Development
      rakeshpai
      rakeshpai
    • RE: Browser-based firmware generator

      Sorry for the long silence. it might look like I've been slacking off (and that's mostly true), but I've also been rolling out some updates:

      • Code can now either be downloaded for the Arduino IDE or for the PlatformIO IDE. The PlatformIO code generates additional config files to use their dependency manager automatically. This means, you don't have to download and install libraries manually. Just open in PlatformIO and build the project. It's magical.
      • Also, you can now download a backup zip of everything. It contains code for the entire network and all it's nodes, and a network.json file. I haven't implemented a 'restore' functionality yet (coming soon), but the network.json file contains everything needed for a restore. The network.json is the internal state data-structure used by the app.
      • Couple of minor performance improvements, especially to help with the first-ever-visit scenario. (All subsequent user actions are blazing fast anyway.)

      To clarify, while backups are a great idea, you don't need to save anything. Stuff is still automatically saved in the browser's storage anyway during regular use, and is persisted even if you close the browser. Backups are for the assurance of having a neat little zip containing everything on your hard drive, just in case things go horribly wrong.

      Very little has changed visually. To find these new features, launch the app, and click the 'hamburger menu' at the top right of the page.

      https://rakeshpai.github.io/mysensors-network-manager/

      posted in Development
      rakeshpai
      rakeshpai
    • RE: Browser-based firmware generator

      Pretty big update: Added the ability to select the board that the node/gateway is based on. Supported boards are: Pro Mini (5v and 3.3v), Nano and Uno for the atmega328 boards, and NodeMCU and D1 Mini for the esp8266 boards. Please let me know if your favourite board isn't listed here.

      The selection of the board effects the list of available pins for sensors. The sense pin dropdown for sensors now shows the appropriate pins (analog/digital/interrupt pins) based on the board selected for the node and the type of sensor being configured.

      The selected board also affects the platformio.ini file generated, which makes PlatformIO integration even more enjoyable to use. No need to specify the board during the build.

      This was a pretty big update, including changes to the underlying internal datastructure itself, so it's also an acid test for the data migration and versioning system implemented before. If you don't see any errors when you refresh after the update, it means everything worked transparently, and that's great news! (The migration mechanism hasn't been tested so far, so please let me know if you see errors when you get the update.)

      Also implemented a reporting interval setting for analog sensors, to bring it in line with the latest changes in NodeManager.

      We're getting closer to being release-ready!

      EDIT: Also, this project crossed 100 commits in GitHub already! Wow!

      posted in Development
      rakeshpai
      rakeshpai
    • Supporting multiple gateways

      Since it is possible to have multiple mysensors gateways communicating with the same controller, how do you identify each gateway uniquely? Do gateways have some sort of unique identifier?

      Usage: I'm planning to put together a controller, and want to support multiple gateways for completeness. Since serial port names and IP addresses might all change over time, how do I associate metadata with a gateway in case of disconnection and reconnection?

      I'm thinking that there should be some sort of unique id associated with a gateway, which I can query over the serial API. Does such a thing exist?

      posted in Controllers
      rakeshpai
      rakeshpai
    • RE: Browser-based firmware generator

      Thanks, @hek and @Anticimex.

      I could add the ATSHA if there's interest. I haven't looked into it yet, and haven't used it, which is why I'm only doing software signing at the moment. If there's interest for it, I'll definitely add it. I'll need to understand how it can be made such that just flashing the SecurityPersonalizer will do everything automatically, so that the user doesn't have to interfere with it.

      Which browser are you using? I've only tested this in Firefox and Chrome on Ubuntu (though the OS shouldn't matter). I haven't tested this on IE. I'm certain it doesn't work on any iOS browser, because of browser limitations. (Limitations can be worked around by using a server.) It might work on Chrome Android, but I don't have access to an Android to test.

      The library I'm using for creating the zip is here: https://stuk.github.io/jszip/ Can you please tell me if their example works for you in your browser?

      Thanks for the catch about the 9-byte device id. I'm also certain that the two other strings I'm using is wrong:
      For the HMAC: "A 64 digit hex number used for signing messages"
      For the AES: "A 32 digit hex number used for encryption"
      If you could help me phrase these correctly, I'll push an update with all three corrections. Thanks.

      posted in Development
      rakeshpai
      rakeshpai
    • RE: Browser-based firmware generator

      @bilbolodz I just updated the UI. Please do a hard-refresh (ctrl+r in chrome), delete your existing network, and try again.

      In general, you shouldn't trust the output code yet. I haven't even run it on an arduino yet. The idea is just to give you a feel for the goals of the app, and find out if people find this useful/interesting.

      Bugs reports are definitely welcome though. A comment on this thread works just fine.

      posted in Development
      rakeshpai
      rakeshpai
    • RE: Browser-based firmware generator

      Sorry for the silence. My ISP is having trouble, and I've been mostly offline. I'm sending this message over crappy 3G on a phone.

      Update

      1. New 'Code' view that shows what the generated code will look like before having to download it. I'm not sure I like this - I would prefer having no mention of code on the UI at all - but it's worth experimenting with. Certainly makes things easy at dev time.
      2. A migrations process, so that I don't have to ask you to delete your existing network, as I have been doing. Migrations will now move your local copy of the data to the latest version automatically, without any manual intervention, if there have been any changes in the data format.

      That's all I have for now. I'll have more once my connectivity issues are fixed.

      posted in Development
      rakeshpai
      rakeshpai

    Latest posts made by rakeshpai

    • RE: Browser-based firmware generator

      @alowhum Sorry, I have abandoned this project. It didn't garner the interest I hoped it would, and I’ve moved on to other microcontrollers/radios/networks since then. This is hosted on GitHub’s free static hosting, so it should continue to work as long as they are in business, and it should work on devices as it was 5-6 years ago. But I won’t be supporting it and won’t continue to build on it. Glad to hear that you like it!

      posted in Development
      rakeshpai
      rakeshpai
    • RE: Integrating NodeManager with Sketch Generator

      @user2684 Sorry, I'm not at a computer. IIRC, the issue I've been facing is that when I used the latest version of NodeManager with the latest version of MySensors dev branch, with signing and encryption, the gateway would crash on startup. This has been preventing me from proceeding.

      Sorry for the lack of detail - I can't verify things at the moment. Looking forward to 1.6!

      posted in NodeManager
      rakeshpai
      rakeshpai
    • RE: Integrating NodeManager with Sketch Generator

      MAX_SENSORS defines the maximum number of child ids

      How can I know how many child ids exist in total? Is there a way to arrive at it from the sensors? Sorry for my ignorance.

      Fixed most of the other bugs you pointed out. Thanks!

      posted in NodeManager
      rakeshpai
      rakeshpai
    • RE: Integrating NodeManager with Sketch Generator

      @user2684 We will need to decide which version of MySensors to use. I've been using the latest version from the development branch. In fact, the ascii-art splash screen is the latest commit, as of 5 days ago. Since you aren't seeing the ascii-art, you are probably on a slightly older commit.

      I'm not sure if we can start supporting from the current stable 2.1.1 onwards? I don't know about the advantages that the new driver for RFM69 brings. If it's any effort at all to get it to work with older versions, it's probably not worth it. I don't mind waiting till 2.2 is released.

      I've simply copy-pasted the MY_RFM_* defines from somewhere in the MySensors examples. They are currently hardcoded 😄 and probably are just the defaults. I'll clean that up.

      Thanks for pointing out the other issues. I'll get on it. Thanks!

      posted in NodeManager
      rakeshpai
      rakeshpai
    • RE: Integrating NodeManager with Sketch Generator

      @user2684 Thanks. That helped identify the problem. I've changed the key switch to inputSwitch to avoid clashes with C keywords, which is causing the issue. I had done this long ago, when I wasn't caring about data migrations. Looks like your data still has that old bit in it.

      Sorry for the trouble. The easiest thing to do is to delete that value, and start afresh. I'll be more diligent about making modifications in the future.

      posted in NodeManager
      rakeshpai
      rakeshpai
    • RE: Integrating NodeManager with Sketch Generator

      @user2684 Thanks. If you haven't already deleted the app_data key, could you please share the value of that key with me? If you've already deleted it, do you remember which sensors you had configured across your nodes in your settings?

      This was an error in the migration process, where the old data is ported over to the new format, if I make changes in the format of the data. I've obviously done something wrong in that porting logic.

      posted in NodeManager
      rakeshpai
      rakeshpai
    • RE: Integrating NodeManager with Sketch Generator

      @user2684 Woops, if you only see the loading message, I've dun goofed. Can you please look in your JS console (Ctrl+Shift+I) and tell me what is the error you see?

      To fix the problem, you can delete your existing data. You can do that within the devtools itself. Click on the Application tab in the devtools, and in the left pane, under Storage, select Localstorage > https://rakeshpai.github.io, and delete the key called 'app-data'. Please make sure you copy your error messages before you do this though, so that I know what went wrong.

      posted in NodeManager
      rakeshpai
      rakeshpai
    • RE: Integrating NodeManager with Sketch Generator

      Sorry for the lack of detail. You can get the latest gateway sketch from the app itself at https://rakeshpai.github.io/mysensors-network-manager/

      The sketch is just a barebones sketch, wiring up the before, presentation, etc. functions to node manager. The config.h is as follows, though nothing stands out to me as being out of place.

      
      #ifndef config_h
      #define config_h
      
      // Message signing
      #define MY_SIGNING_SOFT
      #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      #define MY_SIGNING_REQUEST_SIGNATURES
      
      
      /**********************************
       * Sketch configuration
       */
      
      #define SKETCH_NAME "Gateway"
      #define SKETCH_VERSION "1.0"
      #define MY_REPEATER_FEATURE
      
      
      /**********************************
       * MySensors node configuration
       */
      
      // General settings
      #define MY_BAUD_RATE 9600
      //#define MY_DEBUG
      
      
      // NRF24 radio settings
      #define MY_RADIO_NRF24
      #define MY_RF24_ENABLE_ENCRYPTION
      #define MY_RF24_CHANNEL 76
      #define MY_RF24_PA_LEVEL RF24_PA_LOW
      //#define MY_DEBUG_VERBOSE_RF24
      
      
      // Serial gateway settings
      #define MY_GATEWAY_SERIAL
      
      
      /***********************************
       * NodeManager configuration
       */
      
      // if enabled, enable debug messages on serial port
      //#define DEBUG 1
      
      #define POWER_MANAGER 0
      #define BATTERY_MANAGER 0
      // if enabled, allow modifying the configuration remotely by interacting with the configuration child id
      #define REMOTE_CONFIGURATION 1
      // if enabled, persist the configuration settings on EEPROM
      #define PERSIST 0
      // if enabled, a battery sensor will be created at BATTERY_CHILD_ID and will report vcc voltage together with the battery level percentage
      #define BATTERY_SENSOR 0
      // if enabled, send a SLEEPING and AWAKE service messages just before entering and just after leaving a sleep cycle and STARTED when starting/rebooting
      #define SERVICE_MESSAGES 0
      
      // Enable this module to use one of the following sensors: SENSOR_ANALOG_INPUT, SENSOR_LDR, SENSOR_THERMISTOR, SENSOR_MQ, SENSOR_ML8511, SENSOR_ACS712, SENSOR_RAIN_GAUGE
      #define MODULE_ANALOG_INPUT 0
      // Enable this module to use one of the following sensors: SENSOR_DIGITAL_INPUT
      #define MODULE_DIGITAL_INPUT 0
      // Enable this module to use one of the following sensors: SENSOR_DIGITAL_OUTPUT, SENSOR_RELAY, SENSOR_LATCHING_RELAY
      #define MODULE_DIGITAL_OUTPUT 0
      // Enable this module to use one of the following sensors: SENSOR_DHT11, SENSOR_DHT22
      #define MODULE_DHT 0
      // Enable this module to use one of the following sensors: SENSOR_SHT21
      #define MODULE_SHT21 0
      // Enable this module to use one of the following sensors: SENSOR_SWITCH, SENSOR_DOOR, SENSOR_MOTION
      #define MODULE_SWITCH 0
      // Enable this module to use one of the following sensors: SENSOR_DS18B20
      #define MODULE_DS18B20 0
      // Enable this module to use one of the following sensors: SENSOR_BH1750
      #define MODULE_BH1750 0
      // Enable this module to use one of the following sensors: SENSOR_MLX90614
      #define MODULE_MLX90614 0
      // Enable this module to use one of the following sensors: SENSOR_BME280
      #define MODULE_BME280 0
      // Enable this module to use one of the following sensors: SENSOR_SONOFF
      #define MODULE_SONOFF 0
      // Enable this module to use one of the following sensors: SENSOR_BMP085
      #define MODULE_BMP085 0
      // Enable this module to use one of the following sensors: SENSOR_HCSR04
      #define MODULE_HCSR04 0
      // Enable this module to use one of the following sensors: SENSOR_MCP9808
      #define MODULE_MCP9808 0
      
      #endif
      
      posted in NodeManager
      rakeshpai
      rakeshpai
    • RE: Integrating NodeManager with Sketch Generator

      I'm trying to compile a serial gateway, no sensors, against the development branch of NodeManager, which works fine. However, when I open the serial monitor, I get the following output:

      $ pio device monitor --port /dev/ttyUSB2
      --- Miniterm on /dev/ttyUSB2  9600,8,N,1 ---
      --- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
       __  __       ____
      |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
      | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
      | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
      |_|  |_|\__, |____/ \___|_| |_|___/��
      

      ...and it hangs.

      Any idea what the issue might be?

      PS: As a self-confessed connoisseur of ASCII-art, I tip my hat in your general direction. Well done, good sir.

      posted in NodeManager
      rakeshpai
      rakeshpai
    • RE: Browser-based firmware generator

      Pretty big update: Added the ability to select the board that the node/gateway is based on. Supported boards are: Pro Mini (5v and 3.3v), Nano and Uno for the atmega328 boards, and NodeMCU and D1 Mini for the esp8266 boards. Please let me know if your favourite board isn't listed here.

      The selection of the board effects the list of available pins for sensors. The sense pin dropdown for sensors now shows the appropriate pins (analog/digital/interrupt pins) based on the board selected for the node and the type of sensor being configured.

      The selected board also affects the platformio.ini file generated, which makes PlatformIO integration even more enjoyable to use. No need to specify the board during the build.

      This was a pretty big update, including changes to the underlying internal datastructure itself, so it's also an acid test for the data migration and versioning system implemented before. If you don't see any errors when you refresh after the update, it means everything worked transparently, and that's great news! (The migration mechanism hasn't been tested so far, so please let me know if you see errors when you get the update.)

      Also implemented a reporting interval setting for analog sensors, to bring it in line with the latest changes in NodeManager.

      We're getting closer to being release-ready!

      EDIT: Also, this project crossed 100 commits in GitHub already! Wow!

      posted in Development
      rakeshpai
      rakeshpai