Navigation

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

    alowhum

    @alowhum

    Plugin Developer

    307
    Reputation
    851
    Posts
    2274
    Profile views
    1
    Followers
    0
    Following
    Joined Last Online

    alowhum Follow
    Plugin Developer

    Best posts made by alowhum

    • GUIDE - NRF5 / NRF51 / NRF52 for beginners

      So you're curious about the NRF5 series boards huh? Let's dive in!

      // updates can be found below.

      WHAT IS THE NRF5
      It's a tiny Arm processor based board that can work like an Arduino. There are a few flavours.
      NRF51 $3
      NRF52 $3
      NRF52840 $20 (new, has built in usb support)

      Advantages:

      • Arduino with built in NRF24 for just $3.
      • The size of a postage stamp.
      • Powerful enough to use the simple encryption functionality easily.
      • Antenna socket: just plug in antenna for more range.
      • Ultra low power use.
      • You get to decide which pins do what. For example, you can decide through software which pins should be hardware serial pins. There's a small pin router built in.
      • Built in support for NFC (swiping smart cards and tags).

      Neutral:

      • Has 3.3v internal logic. Most new sensors use 3.3v for logic too.

      Negative:

      • Relatively new, so there might still be some bugs in MySensors.
      • The pins cannot handle as much current (5ma) as the Arduino's could (40ma).
      • Smaller pin spacing (1.27mm instead of 2.54mm), so harder to solder. Fewer expansion boards available.
      • Unlike the Arduino Nano, the programmer doesn't also function as a serial monitor. To get serial output you have to set some pins as the serial output, and then connect to those pins with a separate usb serial port adapter. It's a bit like the Arduino Pro Mini in that sense.
      • The EByte module has no onboard LED, which makes it difficult to know it's on, or to test things with a simple blink sketch.

      INSTALLATION
      Open the Arduino software and install these two boards in the Arduino IDE:
      https://github.com/sandeepmistry/arduino-nRF5
      https://github.com/mysensors/ArduinoBoards
      (click on the links to get installation instructions).

      Carefully soldered some wires to your board, and connected it a programming tool. The cheapest simplest option is to get an ST-Link v2 ($3).

      Connect:
      gnd ->gnd (in the corner)
      3.3v -> vcc (in the same corner)
      SWDIO -> SWDIO
      SWDCLK -> SWDCLK

      alt text

      Software
      In the Arduino IDE open an example (file -> examples -> myboardNRF5 -> myboardNRF5). You will now have three files:

      • Main file <- your main code goes here.
      • MyBoardNRF5.h <- here you can set which goodies you want, on which pins.
      • MyBoardNRF5.cpp <- probably no reason to change anything here.

      In the main file make sure it has these lines:
      #define MY_RADIO_NRF5_ESB
      #include <MySensors.h>

      Upload settings
      In the Arduino IDe click on the tools dropdown and start set things up like this:

      • Board: "MyBoardNRF5 NRF52832"
      • Reset: "don't enable"
      • Bootloader/SD: "none"
      • Low frequency clock: "Crystal Oscilator" (RC Oscillator might work too).
      • Port: none
      • Programmer: ST-Link V2

      First the chip you are using must be 'wiped'. This removes the bluetooth functionality. Wipe the chip by clicking "tools -> burn bootloader". You'll get an error but that's normal.

      Next, when your sketch is complete, choose "sketch -> upload via programmer".

      POWER HUNGRY SENSORS
      If you were using an Arduino Nano before, then you might have powered your sensors directly from the Arduino's 5v pin. With these boards you can't run the power through the NRF5 board first. Make the 5V go 'around it'. Only use these boards to collect and send signals. To get a steady power supply, depending on how much you need, you could try:

      • An AMS1117 regulator. It can generate a max of 800ma at 3.3v. Here's a small version.
      • Special power supply boards such as this one.

      TROUBLESHOOTING

      • Timed out while waiting for target halted: are your pins connected ok?
      • Unable to reset target: are your pins connected ok?

      ADVANCED KNOWLEDGE

      • Some things, like turning on a pin when you press a button, can be handled by (programmed into) the 'periphery' of the chip. Not having to wake up the main chip saves some power. An example of this can be found here.

      POPULAR BOARDS

      Ebyte N73 - Manual

      • Cheap: $3
      • Is missing some parts that allows for super low power usage. Those can be added manually though.
      • Forum users have created some nice pre-made prototyping boards, like this small one or this big one.
      • Uses 91 milli amps max (while transmitting).

      Fanstel BT832X

      • Can't find the price
      • Better range than the EByte
      • Has the required 'DCDC' parts built in, allowing for super low battery usage.
      • Uses 250ma max

      Holyiot TinyBLE

      • About $5
      • Tiny! This also means it has less ports.

      UPDATE

      The easiest way to get started with NRF5 might actually be the BCC Microbit.

      posted in Development
      alowhum
      alowhum
    • Candle - the privacy friendly smart home

      At the upcoming Dutch Design Week from 19 till the 26th of October me and my team will be launching a project called "Candle". It's a privacy friendly smart home demonstrator that is built on, amongst other things, MySensors.

      Candle's goal is to accelerate the development of more privacy friendly smart devices by showing examples of what this future could look like. It proves you don't have to choose between privacy and easy of use. With good privacy design you can have both.

      We have asked artists and designers to create prototypes based on the code and electronics I developed. For example, juweler Dinie Besems created devices with a luxury appeal.

      CO2 sensor by Dinie Besems
      CO2 sensor

      Fine dust sensor by Dinie Besems
      Fine dust sensor

      More on her creations here.

      Engineer Paola Rodrigues also created two devices. This is her version of the Signal hub:

      Signal hub by Paola Rodrigues
      The signal hub can copy and/or learn to recognise 433Mhz devices

      And her version of the temperature, humidity and barometer device (using the BME280):
      Weather station by Paola Rodrigues
      Paola added extra LED's to make the sensor levels readable from far away.

      At the moment designer Jesse Howard, an expert on Open Design, is finishing work on his creations.

      NARRATIVES

      Using MySensors allowed us to really push a number of narratives that are juxtaposed to current IoT design practices:

      • Smart devices often use wifi to connect to the home network and the internet. To us, both of these things were unacceptable. If devices can access the internet themseles, who knows what they are sending. If they can connect to the home network, they form an attractive entrypoint for hackers looking to access other devices on the home network. MySensors, Zigbee/Z-wave and even Bluetooth were more acceptable to us, since since they form their own local network which can be kept separate.
      • Smart devices are often overpowered. Big arm chips, together with the wifi connection, make them an attractive target for hackers, who can use them as beach heads for further invasion of the home network. Candle uses 'minimal viable hardware', in this case the RF Nano. This decreases the attack surface.
      • The power of open source allows users to inspect the code, and thus gain/rebuild trust. In some cases the hardware reflects this call for transparency by being literally transparent. No hidden microphones here.
      • The power of open source allows users to learn more about their technology, and even modify it. It's empowering.

      EDUCATION AND DIY

      A secondary goal was to allow users to relatively easily create the devices themselves. Besides creating the MySensors add-on for the Mozilla WebThings Gatway we also created the Candle Manager add-on. This makes it easy to upload MySensors code to an Arduino. Just connect it through USB to the central controller, and follow the steps in an easy to use interface. Arduino code is then compiled and uploaded to the board, thanks to the new Arduino CLI.

      Candle Manager
      The Candle manager

      To aid in education, all Candle devices can be made without needing to solder. Dupont wires are all you need.

      INNOVATIONS

      MySensors allowed us to quickly prototype and test new privacy enhancing designs and ideas. Some examples are:

      • All Jesse's devices can be disconnected from the MySensors network with a physical hardware switch. While the devices gain functionality when networked together, all of them will also work fine as stand alone devices. For example, all sensors have their own screens to display their current values. Ideally, all smart devices should have a switch with three settings: (1) do not talk (2) data may be shared within the local (MySensors) network (3) Data may shared locally and with the internet.
      • The CO2 sensor has the option to generate 'fake data' by toggling a hardware switch. If you turn this on, it will generate more data that is similar to the last few real measurements. Why it is important to have this feature is explained in depth on the website.

      SOURCE CODE
      Most of the source code can already be found on Github, including the MySensors sketches. More of the code being will be uploaded as the launch exhibit draws closer.

      THANKS

      This project has been made possible with support from the Creative Industries Fund NL. The creation of the machine learning aspects of the project were supported by the SHERPA project, which is a Horizon 2020 research project by the European Union.

      I want to give a special thanks to @Anticimex for creating the user friendly security options. Thank you!

      LOOKING FOR MAKERS

      I am still looking for volunteers that would like to create one or more of the Candle devices and have their creation exhibited alongside the other works. We will pay for your hardware and materials costs. If you're interested, send me a message.

      If you're in the Netherlands at the end of October, please come and say hi at the exhibit.

      posted in My Project
      alowhum
      alowhum
    • Candle won a Dutch National Privacy Award

      I'm proud to say that Candle, the privacy friendly smart home project that's based on MySensors, has won a Dutch National Privacy Award.

      I just wanted to say it literally wasn't possible without all your help, patience, and of course the large amount of open source code that Candle could build upon.

      Thanks everyone!

      privacy_award_mini_exhibit.jpg

      posted in Mozilla WebThings Gateway
      alowhum
      alowhum
    • Candle - signal Hub - A universal 433Mhz signal detector and cloner

      It took three weeks to build, but here it is: a device that will easily connect almost any 433Mhz device to your smart home.

      The 433 Hub can do two things:

      • You can teach it a signal, and from then on it will be able to detect it.
      • You can teach it a signal, and from then on it will be able to replay it.

      Both of these features come in 'single signal' and 'on+off" versions. So for example:

      • You could copy the ON and OFF button from a remote for your 433Mhz sockets, and from then on switch the socket from your smart home controller.
      • You could teach it to detect window sensors that have both on and off states.
      • You could teach it to detect the alarm signal from a wireless smoke detector.

      For each signal that you teach it to recognise, a door sensor will be presented to your controller.
      For each signal that you teach it to replay, an on/off switch will be presented to your controller.

      Signals take between 8 and 28 bytes to store, depending on complexity and if they are simple or on+off signals. This means an Arduino Nano can store between 20 and 60 signals in just half of it's eeprom (512 bytes).

      HARDWARE

      • Arduino

      • 433Mhz receiver & transmitter

      • Touch screen (optional, recommended)
        or

      • OLED screen (optional)

      • Keypad (optional)

      Here's the version that uses a touch screen.
      0_1551117671838_20190218_220842_resized.jpg
      0_1551117742127_20190218_220924_resized.jpg

      Here's a version that uses a keypad.
      0_1547905513000_433hub-lowres.jpg
      With a 12 button keypad you can easily replay 10 signals. The last two buttons are used to navigate and make selections in the menu system.

      You can also trigger the learning sequences from 4 virtual buttons that the device creates on your controller (detect simple, detect on+off, replay simple, replay on+off).

      It works best if you use the touch screen. Using the menu you can delete the last recorded signal, or delete all recorded signals.

      It's designed to work with the upcoming Candle privacy friendly smart home, and the Candle Manager. More on that later this year.

      CODE
      https://github.com/createcandle/Devices/blob/master/Signal-hub/Signal-hub.ino

      posted in My Project
      alowhum
      alowhum
    • Mozilla Webthings MySensors add-on / adapter

      This is an add-on for the excellent Mozilla WebThings Gateway that will allow MySensors devices to work with it.

      .

      THE MOZILLA WEBTHINGS GATEWAY

      This smart home software, made by the people behind Firefox, focuses on being very user friendly. Here are my MySensors devices in the things overview:

      0_1556012649800_mysensors-things.png

      You can also log data with it:

      0_1556012681000_mysensors-log.png

      .

      INSTALLATION

      Just select the add-on via the gateway interface. You're done!

      .

      Q.
      My things are not showing up?

      When the add-on is installed, you will need to restart your nodes so that they present themselves. Once you've restarted all your nodes, click on the (+) button on the things page to add them to your list of things.

      .

      Q.
      Not all my children have been turned into properties?

      Because of the way that things are currently developed, a new child/property will only be added to the device if a 'set' message for it is received. That's because only then does it become clear with which V_TYPE the S_INFO type is populated.

      For example, let's say you send a presentation message for a button:

      present(RELAY_1, S_BINARY, F("Relay 1"));
      

      This child won't show up as a property until you tell the WebThings Gateway if that button should be in the on of off position. So in your setup function you should also do something like:

      send(relaymsg.set(0));
      

      .

      Q.
      Is type X or Y supported?

      The controller page on this website can give you an indication. You can also check how your preferred sensor type is supported by looking at the actual code at the bottom of this file.

      .

      Q.
      Can I make changes to the code?

      Yes you can, and help is always welcome. The code can be found here:

      https://github.com/createcandle/Webthings-mysensors-adapter

      It's based on the excellent work on pyMySensors by Theo Lind, as well as the example add-on created by Michael Stegeman, who works for Mozilla. Thanks to both!

      If you want to use the code manually, perhaps to co-develop it, here's how:

      • Enable SSH (under settings -> developer) and log into the device as normal.
      • Download the code via Github:
      cd ~/.mozilla-iot/addons/
      git clone https://github.com/createcandle/Webthings-mysensors-adapter.git
      

      Now delete the .tgz file and restart the gateway so it no longer loads the .tgz file.

      sudo systemctl restart mozilla-iot-gateway.service
      

      Now you can run the code manually to test it.

      python3 main.py
      

      You will see a lot of messages scroll by.

      The three most important files are in the pkg folder.

      posted in Mozilla WebThings Gateway
      alowhum
      alowhum
    • RE: Mozilla Webthings MySensors add-on / adapter

      Great news: the add-on has been accepted. You can now just select the add-on through the interface of the Mozilla Webthings Gateway.

      Here is it is after installation:
      0_1556265796800_adapter-overview.png

      Once installed you will see the option to change settings:
      0_1556265827400_adapter-settings.png

      Currently these settings don't do anything yet. That will be handled in the next release. First in line will be the ethernet gateway option. In theory the MQTT option should also be possible.

      posted in Mozilla WebThings Gateway
      alowhum
      alowhum
    • RE: Next generation dust sensor for MySensors

      Here's MySensors Arduino code for the PMS-7003. Many thanks to scapeler.com for the core of the code.

      /*
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       *  DESCRIPTION
       *
       *  Plantower PMS-7003 fine dust sensor
       *  
       *  This sensor uses a frickin' laser to measure lots of different fine dust levels, between 0.3 and 10 microns.
       *  
       *  It communicates with your board over serial at 9600 speed.
       *  
       *  
       *  This code makes use of kindly shared code by Scapeler:
       *  
       *  - - -
       *  Copyright 2017 Scapeler
       * 
       * Licensed under the Apache License, Version 2.0 (the "License");
       * you may not use this file except in compliance with the License.
       * You may obtain a copy of the License at
      
          http://www.apache.org/licenses/LICENSE-2.0
      
       * Unless required by applicable law or agreed to in writing, software
       * distributed under the License is distributed on an "AS IS" BASIS,
       * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       * See the License for the specific language governing permissions and
       * limitations under the License.
       * - - -
      */
      
      //------------------------------------------------------------------------------
      
      // if you uncomment this, you can get test and debug updates about the sensor' wireless connection by using the serial monitor tool.
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24                              // A 2.4Ghz transmitter and receiver, often used with MySensors.
      #define MY_RF24_PA_LEVEL RF24_PA_MIN                // This sets a low-power mode for the radio. Useful if you use the verison with the bigger antenna, but don't want to power that from a separate power source. It can also fix problems with fake Chinese versions of the radio.
      // #define MY_RADIO_RFM69                           // 433Mhz transmitter and reveiver.
      
      // Choose if you want this sensor to also be a repeater.
      // #define MY_REPEATER_FEATURE                      // Just remove the two slashes at the beginning of this line to also enable this sensor to act as a repeater for other sensors. If this node is on battery power, you probably shouldn't enable this.
      
      // Are you using this sensor on battery power?
      // #define BATTERY_POWERED                          // Just remove the two slashes at the beginning of this line if your node is battery powered. It will then go into deep sleep as much as possible. While it's sleeping it can't work as a repeater!
      
      #include <SPI.h>
      #include <MySensors.h>
      #include <SoftwareSerial.h>
      
      #define CHILD_ID_DUST_PM10 0
      #define CHILD_ID_DUST_PM25 1
      #define CHILD_ID_DUST_PM100 2
      
      
      // Mysensors settings.
      MyMessage msgDust10(CHILD_ID_DUST_PM10, V_LEVEL);   // Sets up the message format that we'l be sending to the MySensors gateway later.
      MyMessage msgDust10b(CHILD_ID_DUST_PM10, V_UNIT_PREFIX);
      MyMessage msgDust25(CHILD_ID_DUST_PM25, V_LEVEL);   // Sets up the message format that we'l be sending to the MySensors gateway later.
      MyMessage msgDust25b(CHILD_ID_DUST_PM25, V_UNIT_PREFIX);
      MyMessage msgDust100(CHILD_ID_DUST_PM100, V_LEVEL); // Sets up the message format that we'l be sending to the MySensors gateway later.
      MyMessage msgDust100b(CHILD_ID_DUST_PM100, V_UNIT_PREFIX);
      
      
      
      // These defines and variables can be changed:
      int dustSlowDown = 20;                              // The dust sensor is internally checked approximately every 700 or 800 milliseconds. Once in how many loops should it send the data?
      unsigned long dustMeasurementInterval = 700;        // This is a fickle thing. Changing it can give more time-outs.
      SoftwareSerial mySerial(10, 11);                    // RX, TX . You can choose other pins if you prefer.
      
      
      // PROBABLY BEST NOT TO CHANGE THESE VARIABLES
      int inputHigh = 0;
      int inputLow = 0;
      uint16_t inputChecksum = 0;                         // variable to caclulate checksum input variables
      uint16_t concPM1_0_CF1;                             // Lots of sensor variables
      uint16_t concPM2_5_CF1;
      uint16_t concPM10_0_CF1;
      uint16_t concPM1_0_amb;
      uint16_t concPM2_5_amb;
      uint16_t concPM10_0_amb;
      uint16_t rawGt0_3um;
      uint16_t rawGt0_5um;
      uint16_t rawGt1_0um;
      uint16_t rawGt2_5um;
      uint16_t rawGt5_0um;
      uint16_t rawGt10_0um;
      uint8_t  version;
      uint8_t  errorCode;
      uint16_t checksum;
      int dustSlowDownCounter = 0;
      
      
      
      void presentation()
      {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Air Quality Sensor PMS-7003", "1.1");
      
        // Register all sensors to gateway (they will be created as child devices): 
        present(CHILD_ID_DUST_PM10, S_DUST);
        send(msgDust10b.set("um/m3"));  
        present(CHILD_ID_DUST_PM25, S_DUST);
        send(msgDust25b.set("um/m3"));
        present(CHILD_ID_DUST_PM100, S_DUST);
        send(msgDust100b.set("um/m3"));  
      }
      
      
      void setup() {
        Serial.begin(115200);
        delay(1000);
        mySerial.begin(9600);
        delay(1000);
        Serial.println("hello world, I am a sensor.");
      }
      
      
      void loop() {
      
        // The dust sensor sends its data continuously, so let's  catch that data.
        int dustSensorOutput = pms7003ReadData();
        
      }
      
      
      // MAIN FUNCTION FOR THE DUST SENSOR, Thanks to Scapeler.nl
      int pms7003ReadData() {
          
        // while (mySerial.read()!=-1) {};  //clear buffer
      
        if (mySerial.available() < 32) {
          if (mySerial.available() == 0) {
            delay(150);
            return -1;
          };
          if (mySerial.available() > 16) {
            delay(10);
            return -1;
          };
          if (mySerial.available() > 0) {
            delay(30);
            return -1;
          };
          delay(100);
          return -1;
        }
        if (mySerial.read() != 0x42) return -1;
        if (mySerial.read() != 0x4D) return -1;
      
        inputChecksum = 0x42 + 0x4D;
      
        inputHigh = mySerial.read();
        inputLow = mySerial.read();
        inputChecksum += inputHigh + inputLow;
        if (inputHigh != 0x00) return -1; 
        if (inputLow != 0x1c) return -1;    
      
        inputHigh = mySerial.read();
        inputLow = mySerial.read();
        inputChecksum += inputHigh + inputLow;
        concPM1_0_CF1 = inputLow+(inputHigh<<8);
      
        inputHigh = mySerial.read();
        inputLow = mySerial.read();
        inputChecksum += inputHigh + inputLow;
        concPM2_5_CF1 = inputLow+(inputHigh<<8);
      
        inputHigh = mySerial.read();
        inputLow = mySerial.read();
        inputChecksum += inputHigh + inputLow;
        concPM10_0_CF1 = inputLow+(inputHigh<<8);
      
        inputHigh = mySerial.read();
        inputLow = mySerial.read();
        inputChecksum += inputHigh + inputLow;
        concPM1_0_amb = inputLow+(inputHigh<<8);
      
        inputHigh = mySerial.read();
        inputLow = mySerial.read();
        inputChecksum += inputHigh + inputLow;
        concPM2_5_amb = inputLow+(inputHigh<<8);
      
        inputHigh = mySerial.read();
        inputLow = mySerial.read();
        inputChecksum += inputHigh + inputLow;
        concPM10_0_amb = inputLow+(inputHigh<<8);
      
        inputHigh = mySerial.read();
        inputLow = mySerial.read();
        inputChecksum += inputHigh + inputLow;
        rawGt0_3um = inputLow+(inputHigh<<8);
      
        inputHigh = mySerial.read();
        inputLow = mySerial.read();
        inputChecksum += inputHigh + inputLow;
        rawGt0_5um = inputLow+(inputHigh<<8);
      
        inputHigh = mySerial.read();
        inputLow = mySerial.read();
        inputChecksum += inputHigh + inputLow;
        rawGt1_0um = inputLow+(inputHigh<<8);
      
        inputHigh = mySerial.read();
        inputLow = mySerial.read();
        inputChecksum += inputHigh + inputLow;
        rawGt2_5um = inputLow+(inputHigh<<8);
      
        inputHigh = mySerial.read();
        inputLow = mySerial.read();
        inputChecksum += inputHigh + inputLow;
        rawGt5_0um = inputLow+(inputHigh<<8);
      
        inputHigh = mySerial.read();
        inputLow = mySerial.read();
        inputChecksum += inputHigh + inputLow;
        rawGt10_0um = inputLow+(inputHigh<<8);
      
        inputLow = mySerial.read();
        inputChecksum += inputLow;
        version = inputLow;
      
        inputLow = mySerial.read();
        inputChecksum += inputLow;
        errorCode = inputLow;
      
        Serial.print("PMS7003;"); 
      
        // The measurement recalculated to micrograms per cubic meter, a common standard.
        Serial.print(concPM1_0_CF1);
        Serial.print(';'); 
        Serial.print(concPM2_5_CF1);
        Serial.print(';'); 
        Serial.print(concPM10_0_CF1);
        Serial.print(';'); 
      
        // The measurement recalculated to micrograms per cubic meter, a common standard. Not quite sure what the difference is..
        Serial.print(concPM1_0_amb);
        Serial.print(';'); 
        Serial.print(concPM2_5_amb);
        Serial.print(';');     
        Serial.print(concPM10_0_amb);
        Serial.print(';');     
      
        // this is the 'raw' data that the sensor gathers internally, before it calculates the above values.
        Serial.print(rawGt0_3um); // This indicates total number or particles in 0.1 liter of air that have a diameter above 0.3um. This will be the biggest number, as it measures the most particles. But it's very imprecise: 50% accuracy..
        Serial.print(';');
        Serial.print(rawGt0_5um); // This indicates the total number or particles in 0.1 liter of air that have a diameter above 0.5um (so it will be a smaller count than the line above)
        Serial.print(';'); 
        Serial.print(rawGt1_0um); // This indicates the total number or particles in 0.1 liter of air that have a diameter above 1 micron. And so on..
        Serial.print(';'); 
        Serial.print(rawGt2_5um);
        Serial.print(';'); 
        Serial.print(rawGt5_0um); // Acording to the datashet, at this point the accuracy has reached at 98%.
        Serial.print(';'); 
        Serial.print(rawGt10_0um);
        Serial.print(';'); 
        Serial.print(version);
        Serial.print(';'); 
        Serial.print(errorCode);
        Serial.println("---");
        
        inputHigh = mySerial.read();
        inputLow = mySerial.read();
        checksum = inputLow+(inputHigh<<8);
        if (checksum != inputChecksum) {
          Serial.print(';'); 
          Serial.print(checksum); 
          Serial.print(';'); 
          Serial.print(inputChecksum); 
        }
      
        // Time to send the results to the gateway.
        dustSlowDownCounter = dustSlowDownCounter + 1;
        if(dustSlowDownCounter > dustSlowDown){
          
          /*  MEASUREMENT  */
          if(rawGt1_0um > 0){
            Serial.println(" Dust1_0 = " + String(concPM1_0_CF1));
            send(msgDust10.set(concPM1_0_CF1,1));
          }         
          if(rawGt2_5um > 0){
            Serial.println(" Dust1_0 = " + String(concPM2_5_CF1));
            send(msgDust25.set(concPM2_5_CF1,1));
          }     
          if(rawGt10_0um > 0){
            Serial.println(" Dust1_0 = " + String(concPM10_0_CF1));
            send(msgDust100.set(concPM10_0_CF1,1));
          }     
      
          /*  RAW DATA  */            
          /*
          if(rawGt0_3um > 0){
            Serial.println(" Dust03 = " + String(rawGt0_3um));
            send(msgDust03.set(rawGt0_3um,1));
          }
          if(rawGt0_5um > 0){
            Serial.println(" Dust05 = " + String(rawGt0_5um));
            send(msgDust05.set(rawGt0_5um,1));
          }
          if(rawGt1_0um > 0){
            Serial.println(" Dust10 = " + String(rawGt1_0um));
            send(msgDust10.set(rawGt1_0um,1));
          }
          if(rawGt2_5um > 0){
            Serial.println(" Dust25 = " + String(rawGt2_5um));
            send(msgDust25.set(rawGt2_5um,1));
          }
          if(rawGt5_0um > 0){
            Serial.println(" Dust50 = " + String(rawGt5_0um));
            send(msgDust50.set(rawGt5_0um,1));
          }      
          if(rawGt10_0um > 0){
            Serial.println(" Dust100 = " + String(rawGt10_0um));
            send(msgDust100.set(rawGt10_0um,1));
          }   
          */
      
          dustSlowDownCounter = 0;
        } // End of sensing message.
        
        delay(700);  // Data will come between 200 and 800 miliseconds. If you set this be be higher than 700 you will get checksum errors.
          
        return concPM2_5_CF1; // this data doesn't really go anywhere..
      }
      
      
      
      
      posted in General Discussion
      alowhum
      alowhum
    • RE: New non-blocking temperature sensor code

      I've added your suggestions, cleaned the code to conform to standards better, and tested the new version in various configurations.

      I've created a pull request on Github for this to become the new code. And a few days ago I created a page on OpenHardware.io that could be the start of a new page about the sensor, if need be.

      Once my BME280 sensor arrives, I will create a new seperate version based on that. My suggestion is that the MySensors homepage should somehow point to two temperature sensors:

      • One for mass sensor network deployment (this one, based on the cheap Dallas).
      • One for home automation (the more expensive but awesome BME280).
      posted in Development
      alowhum
      alowhum
    • MySensors Smart Watch

      After a bit of discussion in the nRF5 thread, it might be useful to create a thread specifically focussed on the subject of re-purposing cheap nRF5 smart watches to use as MySensors nodes.

      Why would I want a MySensors smart watch?

      • If you want a power sipping node with an oled screen and a few sensors.. well you just described a smart watch.
      • From a privacy perspective, most smart watches are horribly designed. A MySensors smart watch could offer the advantages of a smart watch without all the cloud connections and bluetooth tracking risks.
      • It's cool.

      What has been done?
      Surprisingly, quite a bit. Have a look here:
      https://github.com/micooke/arduino-nRF5-smartwatches/
      https://github.com/curtpw/nRF5x-device-reverse-engineering
      https://github.com/goran-mahovlic/nRF51_ID107_libs
      https://github.com/goran-mahovlic/openwatch

      What should I look out for?

      • The holy grail would be a smart watch that can be updated via DFU over the air. That way you don't have to open it, which often destroys any waterproofing. Of course this only matters if you want to actually use it as a watch and not, say, as a small tabletop display.
      • In some of these cheap devices the heart rate and/or blood pressure devices are very poor quality, meaning you will get eratic results.
      • Currently you may need a JLink or Black Magic Probe debugger to gain control over these devices.

      Discussion
      There is a chat here

      Popular devices

      • ID107HR - It's an older NRF51, but the advantage is that the screen has been mapped, the pads are clear, and it can be opened with a small screwdriver. It's your best bet.
      • ID107HR Plus - NRF52 version. The screen doesn't seem to be mapped yet. It's glued shut, and incredibly difficult to open.

      Getting started

      • Get or make a Black Magic probe.
      • Buy an ID107HR (€15 at Gearbest)
      1. Install sandeep's git from https://github.com/sandeepmistry/arduino-nRF5. Do refer to instructions at the bottom of the git to install as a development core (supports Black Magic Probe), i.e. clone/copy repo into 'Arduino/hardware/sandeepmistry/nRF5' folder.
      2. Install ARM Cortex support by installing SAMD boards via Arduino Board Manager interface.
      3. Overwrite the variants files located in your 'Arduino/hardware/sandeepmistry/nRF5/variants/Generic' folder' using the files from https://github.com/rogerclarkmelbourne/arduino-nRF5-customised/tree/master/variants/ID107HR_smartwatch.
      4. Install Goran's git from https://github.com/goran-mahovlic/nRF51_ID107_libs and load up the example sketch of 'SmartyV2ClockOledAcc.ino'.
      5. Select the Board 'Generic nRF51' from the 'Nordic Semiconductor nRF5 Boards' menu. Select the 'Black Magic Probe (GDB)' from the programmer menu. Compile/upload.
      posted in General Discussion
      alowhum
      alowhum
    • RE: Where did everyone go?

      I used MySensors to create a privacy friendly smart home demonstrator called Candle. Quite a few people are building it, but they may not even realise they are using MySensors.

      In this project my own attention certainly has shifted a bit. Cheap Zigbee dongles and devices aid my goal of moving Candle in a more consumer friendly direction, so that people could just buy most of the parts ready-to-go, and still keep everything local. Some devices will still be MySensors devices, simply because there aren't any privacy friendly alternatives that I know of. But a temperature and humidity sensor, those use Zigbee for me now. And I'm moving the privacy features from the arduino code into the central controller instead.

      Speculation about other factors:

      • Practical Arduino hardware education isn't happening right now because of covid. And even there, there are so many hardware options now. Microbits, ESP32, etc.
      • I've also noticed people asking about standardisation, and caring about interoperability.
      • There are many more products available now. Edge cases are being catered to, e.g. gardening.

      Things that might help for me:

      • I really wish there was a cheap, widely available Arduino akin to the RF-Nano, but with RFM69 433Mhz. MySensors has always had range issues for me on 2.4ghz.
      • The MySensors implementation doesn't make it easy for devices to describe the UI they would like. E.g. if a device is read-only or toggle-able is currently dependent on the type, instead of being a factor that can be set for each sensor type independently.

      A new website with a strong focus on new users, USP's (cheap privacy & friendly, or just fun, educational and artisanal) and up-to-date examples might help.

      This all may sound critical, but that's not the intention. I really dig MySensors. It's definitely in my toolbelt.

      posted in General Discussion
      alowhum
      alowhum

    Latest posts made by alowhum

    • RE: MySensors in a NERF gun - a question about capacitors

      I thought I'd give an update.

      I added four .470 capacitors in paralel, but the gun was still turning itself off. Then I added the diode, and.. it worked! The gun remains stable.

      ...at least.. while it was on a beefy lab power supply. It indicates that when firing the gun uses about .6 amps, and it prefers to be around 8.5 volts (6 AA batteries). 9 volts seems to be too much.

      I tried to switch it to the intended portable design, with a USB PD decoy feeding into a 4A up-down adjustable buck converter.

      But then it crashes again.

      For example, I tried this:

      • 55W steam deck USB-C PD power supply ->
      • adjustable decoy set to 15 or 20 volt.
      • down-converting that to 8.5v with the buck converter.

      Maybe all this power converting means that it can't provide the sudden increases in power when the motor spins up?

      Perhaps using a linear DC-DC converter work better? Or maybe the USB-PD decoy just can't handle it? It's a mystery.

      posted in Troubleshooting
      alowhum
      alowhum
    • RE: MySensors in a NERF gun - a question about capacitors

      Thanks. I'll look into it.

      posted in Troubleshooting
      alowhum
      alowhum
    • RE: MySensors in a NERF gun - a question about capacitors

      @ejlane Could a resistor be used for that?

      posted in Troubleshooting
      alowhum
      alowhum
    • RE: MySensors in a NERF gun - a question about capacitors

      I think capacitors with a blocking diode would be the right call..

      Cool!

      That calculation clears up so much. Really great explanation, thank you!

      It seems a diode is needed either way.

      The power supply runs both the Arduino the blaster itself, which means the two motors it uses. One motor spins the barrel (purely as an optical effect), and other one actually shoot out the darts.

      for a hobby level project maybe simply going 10x for a few pennies more would be a good idea

      Glad to hear that (other than cost) there is no problem with using a way too big capacitor. That also simplifies building up a stock 🙂

      posted in Troubleshooting
      alowhum
      alowhum
    • MySensors in a NERF gun - a question about capacitors

      So I have this huge NERF gatttling gun that I was trying to have some fun with. I wanted to be able to lock or unlock the trigger remotely based on face recognition, which is handled by a mobile phone at the front of the gun.

      The problem I ran into is that whenever the gun's motors spin up then cause a power loss to the arduino. Now I could add a separate power supply for the Arduino, but it would obviously be much cleaner if it looks like a normal gun from the outside.

      So I figured I needed some kind of "electrcity buffer" that would continue to provide the Arduino with stable power whenever the motors spin up.

      I realised I know very little about capacitors.

      • Which type do I need? Some are "aluminium high frequency". Are motors high frequency? Should I get those? Do they charge up faster?
      • Is there any risk that a capacitor makes the situation worse? E.g. if it's empty and it sucks up electricity that should be going to the Arduino?
      • Some go up to 400 volts. Some seem a perfect match at 5.5 volts. How do you choose what voltage rating to get? Is there a trade-off? Is it wise to go a few volts above the voltage in your system?
      • I figured I wanted as many Farads as possible? So I found these capacitors with 4F. But I realised I have no idea if that's a lot. How can I compare it to, say, batteries? How long can a 4F 5.5v capacitor run an Arduino nano + radio?
      • Is there a downside to having a lot of Farads, other than the cost?
      • How do I make sure the energy in the capacitor is "reserved" for the Arduino? After all, the motors are on the same circuit, and could perhaps suck it dry instead?
      posted in Troubleshooting
      alowhum
      alowhum
    • RE: 💬 6Gang30AmpsLatchRelayEspHomeReady

      Incredible. The "yeah it's a hobby" terrain has been left far behind.

      posted in OpenHardware.io
      alowhum
      alowhum
    • RE: Mozilla Webthings MySensors add-on / adapter

      If you want the latest developments if this addon, please use the Candle Controller instead of the Webthings Gateway. Candle is a fork of Webthings that I also work on. Going forward it's your best bet for updates.

      https://www.candlesmarthome.com

      posted in Mozilla WebThings Gateway
      alowhum
      alowhum
    • RE: Where did everyone go?

      I used MySensors to create a privacy friendly smart home demonstrator called Candle. Quite a few people are building it, but they may not even realise they are using MySensors.

      In this project my own attention certainly has shifted a bit. Cheap Zigbee dongles and devices aid my goal of moving Candle in a more consumer friendly direction, so that people could just buy most of the parts ready-to-go, and still keep everything local. Some devices will still be MySensors devices, simply because there aren't any privacy friendly alternatives that I know of. But a temperature and humidity sensor, those use Zigbee for me now. And I'm moving the privacy features from the arduino code into the central controller instead.

      Speculation about other factors:

      • Practical Arduino hardware education isn't happening right now because of covid. And even there, there are so many hardware options now. Microbits, ESP32, etc.
      • I've also noticed people asking about standardisation, and caring about interoperability.
      • There are many more products available now. Edge cases are being catered to, e.g. gardening.

      Things that might help for me:

      • I really wish there was a cheap, widely available Arduino akin to the RF-Nano, but with RFM69 433Mhz. MySensors has always had range issues for me on 2.4ghz.
      • The MySensors implementation doesn't make it easy for devices to describe the UI they would like. E.g. if a device is read-only or toggle-able is currently dependent on the type, instead of being a factor that can be set for each sensor type independently.

      A new website with a strong focus on new users, USP's (cheap privacy & friendly, or just fun, educational and artisanal) and up-to-date examples might help.

      This all may sound critical, but that's not the intention. I really dig MySensors. It's definitely in my toolbelt.

      posted in General Discussion
      alowhum
      alowhum
    • RE: HomeAssitant MySensors plugin Roadmap

      I've also used them both. Now I'm a very happy Webthings Gateway user. Try it!

      [edit by nca78] fixed link, should be without www.

      posted in Home Assistant
      alowhum
      alowhum
    • RE: Modifying A0 value to Percentage

      Perhaps this code is of interest to you. It's the Candle plant health sensor. It's got all the bells and whistles you could want, including optional support for automated irrigation.

      One thing you'll notice in there is that the capacitive moisture sensors output voltages between 0 and 3. So in @rvendrame's code you may have to change the 1023 to 650, and also make sure no voltages higher than that would lead to percentages above 100%.

            int16_t moistureLevel = analogRead(analog_pins[i]);
            Serial.print(F("raw analog moisture value: "));
            Serial.println(moistureLevel);
      
            if( moistureLevel > 650 ){moistureLevel = 650;}
            moistureLevels[i] = map(moistureLevel,0,650,0,99); // The maximum voltage output of the capacitive sensor is 3V, so since we're measuring 0-5v about 614 is the theoretical highest value we'll ever get.
      

      I notice in your code that the title Analog Soil Moisture Sensorx3 is too long. It can't be longer than 25 characters.

      posted in General Discussion
      alowhum
      alowhum