Introduction: Edison and Arduino/Genuino 101 Wireless Weather Station

This Instructable describes an Intel(r) Edison- and Arduino/Genuino 101-based modular wireless weather station I've recently created for my home use.

Foundational concepts, which defined the setup and solutions, were:

  • To have a modular solution, where I can add sensors to sensor modules and sensor modules themselves as needed as well as be able to tear it down in case I realize I don't really need a weather station;
  • To have a wireless solution with
    • Base module, which does main data processing, cloud upload and hosts user interface (web-based);
    • Sensor modules, which are distributed across the premises and are smaller, cheaper, potentially battery-powered and do sensor data acquisition only;
  • To have the following data available:
    • temperature and humidity from each zone I was interested in;
    • atmospheric pressure (naturally just a single value);
  • Long-term data analysis and observation is done in a cloud (ThingSpeak), so the web UI is only intended for short-term observations and current data display;
  • KISS: if there's no need in an abstraction layer in SW - I haven't created one.

Attached to this step is a conceptual diagram outlining the setup based on those as well as photo of an assembled Base and Sensor modules + a web interface screenshot.

I picked Bluetooth as a Base module-to-Sensor module communication interface and Wi-Fi as a Base module-to-user/Base module-to-cloud communication interface. It also was clear that I don't need a Sensor module in a zone where Base module resides, as it's not a cost-effective approach, so some sensors would also need to be hooked to the Base module itself.

I've described additional considerations I had on this in a dedicated blog post.

Step 1: Bill of Materials

I've used the following parts for the station (all links and images are just examples, images are copied from manufacturer or reseller websites within the fair use guideline). These are not the only ones, which could be used, I picked them based on cost and availability in my area.

Base module:

  1. Intel Edison with Arduino expansion board - 1pc.
  2. SparkFun HTU21D sensor breakout (for humidity and temperature, I2C) - 1pc.
  3. Generic BMP180 sensor breakout known as GY-68 (for atmospheric pressure and another temperature, I2C) - 1pc.
  4. Small prototyping board, like this, which will host both sensors.
  5. Some generic plastic enclosure with cutouts so that temperature sensor has access to the outside.
  6. 8 male-male breadboard wires to connect sensors to Edison

Sensor module (multiply by the number of zones you want to cover):

  1. Arduino/Genuino 101 board (I liked the built-in BTLE and in general wanted to try it out) - 1pc.
  2. AM2302 or DHT-22 or equivalent sensor (humidity and temperature, protocol similar to 1-wire) - 1pc.
  3. Arduino enclosure (liked this one due to very goot fit and additional space inside in case I need it) - 1pc.
  4. Battery or a wall socket-to-USB adapter (I used both). Battery way has its limitations, see my blog post on this. Something like this will keep the sensor module running for around 5 days.
  5. 3 male-female breadboard wires to connect the sensor to Arduino/Genuino 101

Step 2: Assemble Base Module

  1. Connect sensors to the breadboard and then to the Edison according to the diagram attached. I couldn't find namely the GY-68 module part for Fritzing, but the connections are pretty much the same. You'll need to disable pullup resistors on the HTU21D module from SparkFun as on GY-68 they exist as well and are not detachable (at least not easily). Generally the principle is simple - power, ground and I2C's SCL and SDA lines + passthrough to the second sensor module. At the end of this both your modules will be on the same I2C bus of the Edison.
  2. Put Edison and breadboard into the enclosure, fix them using glue or screws, whatever your enclosure allows for. Make sure the humidity sensor is close to the enclosure cutouts so that it measures the right thing. Location of the pressure one is not so important. In my specific model of the enclosure (see BoM step) I had to also cut out an opening on a side wall for power plug and USB ports.
  3. Configure your Edison to use your Wi-Fi network, per standard Intel docs.
  4. Update mraa and UPM libraries to the latest versions available by running "opkg update && opkg install mraa upm" in the board's SSH or serial console.
  5. Download or create a git clone of my GitHub repo for this project into /home/root/edison-weather-station directory on the board.

Step 3: Assemble Sensor Module(s)

  1. Make a cutout in the enclosure's detachable cover (intended for 9V battery), so that you can put sensor's pins into it while putting the sensor itself onto the cover. You'll need to bend sensor's pins at 90 degrees to do that. As you can see on screenshots, I first tried to do it by just drilling holes per pin - but given the length of pins and thickness of the enclosure, that required extending sensor pins by soldering extension pins to them - which is a very inconvenient way, because plastic melts during the process and it becomes messy. Last photo with an enclosure shows a different approach - I've just milled a bigger cutout, so that female part of the wire could go all the way up. That's much easier to do and looks not really much worse :)
  2. Insert Arduino/Genuino 101 into the enclosure.
  3. Connect Arduino's 5V pin to sensor's pin #1 (counting from the left, see e.g. here or just google it), Arduino's pin #2 to sensor's pin #2 and Arduino's GND pin to sensor's pin #4. See the end result on a photo.
  4. Glue the sensor to the detachable cover, put the cover into its place, close the enclosure.
  5. Download and install Arduino IDE from http://arduino.cc, in the Board Manager download support pack for intel Curie boards (see screenshot), install one of the two DHT libraries I've tested and upload the sensor module sketch you can take from my Edison Weather Station project GitHub repo
  6. For the second and further sensor modules, change the module name visible through Bluetooth at line 32 of the sketch
  7. After that you should be able to see your sensor module's data through any capable Bluetooth app on your smartphone, e.g. this one which is shown on the screenshot. There's also a debug mode in the sketch, managed by a define - after enabling it will also output sensor data to IDE's Serial Monitor.
  8. Connect it to the battery pack or wall socket USB adapter and place it where you intend it to be.

Step 4: Run It All Together

  1. On the Edison, run

    NODE_ENV=development node /home/root/edison-weather-station/ws-base-module/main.js

    command, which should start the whole Base module code in a development mode, which prints out a lot of useful debug information to the console. Check that it finds your sensor modules and that sensor information from local and remote sensors is meaningful. Check power, physical connections and software setup if something doesn't work or crashes. ThingSpeak upload failures are expected at this point, because you don't have necessary TS configuration yet. Check out step 5 and use the above command to check it out afterwards.
  2. Check that you can access the web interface by visiting "http://your Edison IP address:3000" URL. You should see something like the attached screenshot.
  3. After that you can exit by pressing Ctrl+C and configure the Base module code to autostart in the production mode (i.e. without unnecessary output, all logs will go into System journal accessible via "journalctl" command) by copying the Systemd service definition file from my repo copy to a proper place by running

    cp /home/root/edison-weather-station/ws-base-module/edison-weather-station.service /lib/systemd/system/

    and then enabling the service itself by running

    systemctl enable edison-weather-station

    and finally starting it by running

    systemctl start edison-weather-station
  4. Double-check that web-interface is still accessible and refreshes automatically as intended.

Step 5: Create Necessary ThingSpeak Configuration

  1. To use the cloud upload part of the weather station, you need to configure ThingSpeak channels per each module, including the Base one and then paste channel write keys into proper Base code file.
  2. Register an account in ThingSpeak, create new channel for Base module, name it "BaseModule::LocalSensors" (i.e. same as it's called in the web UI - the code uses this name when posting) and as many additional channels as you have Sensor modules, also using the names per web UI. Register fields in each channel corresponding to the sensor data items - order in the web UI should determine field order (see screenshots).
  3. Paste channel write keys into ws-cloud-config.js file in the ws-base-module directory, using the format described in the file. There should be one entry per one channel (=per each module, including Base).
  4. Use development mode command from step 4 or just watch the channels to ensure upload works fine and you are done!

    Enjoy your shiny new and extremely extensible wireless weather station :D

Internet of Things Contest 2016

Participated in the
Internet of Things Contest 2016

Sensors Contest 2016

Participated in the
Sensors Contest 2016