Introduction: IOT123 - ASSIMILATE SENSOR HUB: ICOS10 3V3 MQTT NODE

About: The tension between novelty and familiarity...

This is the first in a variety of MCU/Feature combinations in the ASSIMILATE SENSOR HUBS: the masters that collect the data dumps from the I2C ASSIMILATE SENSORS slaves.

This build uses a Wemos D1 Mini, to publish any data dumped from the ASSIMILATE SENSORS to a MQTT server. It supplies a 3V3 I2C bus to the sensors. A 5V rail is still supplied but there is not a logic level converter for the 5V I2C and it may not function as desired. This will be delivered in a future feature-set daughter-board replacement for the one presented here.

If you have not done so already, the generic outer shell will need to be assembled.

Step 1: Materials and Tools

ICOS10 (IDC) Shell Bill of Materials

  1. D1M BLOCK Pin Jig (1)
  2. D1M BLOCK base and housing (1)
  3. Wemos D1 Mini (1)
  4. Wemos D1 Mini Protoboard Shield (1)
  5. 40P Female Headers (8P, 8P, 9P, 9P))
  6. 1" Double sided protoboard (1)
  7. 6 Pin Shrouded IDC Male Header (1)
  8. Hookup wire (~10)
  9. 0.5mm Tinned Wire (~4)
  10. 4G x 15mm Button head self tapping screws (2)
  11. 4G x 6mm self tapping countersunk screws (~20)

Step 2: MCU Preparation

In this build we are using the Wemos D1 Mini. If you have previously built a D1M WIFI BLOCK, you can use that for the modular hardware component. If not, as a bare minimum follow the next section.

SOLDERING THE HEADER PINS ON THE MCU (using the PIN JIG)

If you cant print a PIN JIG just follow the instructions and improvise: the height (offset) of the PIN JIG is 6.5mm.

  1. Print/obtain a PIN JIG from this page.
  2. Feed the header pins through bottom of the board (TX right-left) and into the solder jig.
  3. Press the pins down onto a hard flat surface.
  4. Press the board down firmly onto the jig.
  5. Solder the 4 corner pins.
  6. Reheat and re position board/pins if needed (board or pins not aligned or plumb).
  7. Solder the rest of the pins.

UPLOADING THE FIRMWARE

The GIST for the code is here (5 files) and a zip is here. The instructions for using the Arduino IDE for compile/upload of code is here.

To use the code with only minor modifications, we are using Joël Gähwiler's shiftr.io as the MQTT broker: it has a guest account - so please keep the interval of publications minutes apart. It provides a visualualization of the source and topics, as well as drill downs to the data.

Once the code has been loaded into the Arduino IDE:

    1. Modify the value of _wifi_ssid with your WiFi SSID.
    2. Modify the value of _wifi_password with your WiFi Key.
    3. Modify the value of _mqtt_clientid with your preferred Client Identification (no joining needed).
    4. Modify the value of _mqtt_root_topic with the location hierarchy of the device location.
    5. Compile and upload.

    Step 3: MCU Housing Preparation

    The MCU Housing exposes headers for the D1 Mini to plug into and headers for daughter-boards that communicate with the Socket (sensors and actors) circuit.

    HOUSING HEADERS

    This is based on a D1 Mini Protoboard, and breaks out:

    1. Pins for the D1M BLOCK/D1 Mini to connect to.
    2. Direct Breakouts of the 2 rows of contacts from the D1M BLOCK/D1 Mini. These are only available for convenience whilst prototyping. It is expected the daughter-boards will block all access to these headers.
    3. 4 Breakouts of the specific pins used by the daughter-boards. I considered only breaking out the I2C specific pins but I already had a use-case for use of another pin (low-side sleep power switch), so I broke out RST, A0 and some other digital pins just in case.

    To add the D1M Contacts to the HOUSING HEADER:

    1. Watch the SOLDER USING THE SOCKET JIG video.
    2. Feed the header pins through bottom of the board (TX top-left on the top side).
    3. Feed jig over plastic header and level both surfaces.
    4. Turn jig and assembly over and firmly press header onto a hard flat surface.
    5. Press the board down firmly onto the jig.
    6. Solder the 4 corner pins using minimal solder (just temporary alignment of pins).
    7. Reheat and re position board/pins if needed (board or pins not aligned or plumb).
    8. Solder the rest of the pins.
    9. Remove the jig.
    10. Cut pins off above solders.

    To add the Daughter-board Breakouts:

    1. Cut 4 off 9P Female headers.
    2. On the top, insert the 9P Headers as shown, and solder off on bottom.

    To add the Direct Breakouts:

    1. Cut 2 off 8P Female headers.
    2. On the top, insert the 8P Headers as shown, and solder off on bottom.

    To connect the headers, on the bottom with the TX pin oriented up:

    1. Trace and solder from the RST pin across 4 pins.
    2. Trace and solder from the A0 pin across 4 pins.
    3. Trace and solder from the D1 pin across 4 pins.
    4. Trace and solder from the D2 pin across 4 pins.
    5. Trace and solder from the D6 pin across 4 pins.
    6. Trace and solder from the D7 pin across 4 pins.
    7. Trace and solder from the GND pin across 4 pins.
    8. Trace and solder from the 5V pin across 4 pins.
    9. Trace and solder from the 3V3 pin down 45° across 4 pins.

    ASSEMBLING THE FIXTURE

    The HOUSING HEADERS is affixed to the MCU HOUSING and this is affixed to the BASE PLATE.

    1. With the long side of the HOUSING HEADERS pointed to the hole, insert the D1M CONTACTS into the openings in the MCU HOUSING and push down flush.
    2. Insert the MCU onto the MCU CONTACTS during affixing to ensure the correct alignment.
    3. Place the HEADER FRAME over the top of the assemble fixtures and affix with 2 of 4G x 16mm screws.
    4. Place the assembled fixtures with the hole pointed toward the short side and affix with the 4G x 6mm screws.

    Step 4: Building the 3V3 I2C Daughter-board

    This provides an IDC Header for the SOCKETS CIRCUIT and connects to the MCU, adding pull-ups on the I2C lines. This is provided as a daughter-board so that if you need 5V logic level converters, you can just swap this board out with one that provides all the functions needed. The AUX and GND lines are broken out for custom sources (like low side switches during sleep cycles). The layouts are defined by inside and outside: on the board choose an arbitrary side to use as inside; the important thing is the IDC Header should be on the edge pointing out.

    1. On the inside, insert the 2P 90° Male Headers (1), 3P 90° Male Header (2), and solder off on the outside.
    2. On the inside, insert the 1P Male Header (3), 2P Male Headers (4), and solder off on the outside.
    3. On the outside, insert the IDC Header (5), and solder off on the inside.
    4. On the inside, trace a black wire from BLACK1 to BLACK2 and solder.
    5. On the inside, trace a black wire from BLACK3 to BLACK4 and solder.
    6. On the inside, trace a white wire from WHITE1 to WHITE2 and solder.
    7. On the inside, trace a green wire from GREEN1 to GREEN2 and solder.
    8. On the inside, trace a red wire from RED1 to RED2 and solder.
    9. On the inside, trace a yellow wire from YELLOW1 to YELLOW2 and solder.
    10. On the inside, insert a 4K7 resistor into SILVER1 and SILVER2 and leave leads uncut.
    11. On the inside, trace a bare wire from SILVER5 to SILVER6 and solder.
    12. On the inside, trace the lead from SILVER1 to SILVER3 and solder.
    13. On the inside, insert a 4K7 resistor into SILVER4 and SILVER2 and solder.

    Step 5: Assembling the Major Components

    1. Ensure the SHELL has been built and the circuit tested (cable and sockets).
    2. Insert the 3V3 I2C DAUGHTER-BOARD, with the 3V3 pin on the ragged end of the headers (see pic).
    3. Place a Jumper on the 2P Male Header on the DAUGHTER-BOARD.
    4. Insert the IDC Socket from the SHELL CABLE into the IDC Header on the DAUGHTER-BOARD.
    5. Carefully insert the DAUGHTER-BOARD/HOUSING between the cables in the SHELL and align the base holes.
    6. Fasten the BASE ASSEMBLY to the SHELL with the 4G x 6mm screws.
    7. Attach any ASSIMILATE SENSORS you have made.

    Step 6: Next Steps

    Power up your new device (5V MicroUSB).

    Point your browser at https://shiftr.io/try and check the visualization of your data.

    Drill down by clicking on nodes in the graph.

    Open a console window to check some rudimentary status logging.

    When satisfied, change the details with your own MQTT Broker account/server.

    Check out these related builds.

    Next on the cards is developing the ACTORS for the ASSIMILATE IOT NETWORK.