Introduction: IOT123 - I2C DHT11 BRICK
The IOT123 BRICKS are DIY modular units that can be mashed up with other IOT123 BRICKS, to add functionality to a node or wearable. They are based on the inch square, double-sided protoboards with interconnected through holes.
A number of these BRICKS are expected to be on multiple nodes (Master MCUs - ESP8266 or ATTINY84) on a site. The MCU needs no prior knowledge of the sensors purpose or software needs. It scans for I2C nodes then requests a property dump (sensor data) from each slave. These BRICKs supply 5.0V, 3.3V and another AUX line which is customizable.
This I2C DHT11 BRICK dumps 5 properties:
Humidity (%), Temperature (C), Temperature (F), Temperature (K), Dew Point (C).
The Keyes type sensor bricks will be abstracted first as they come with vitamins (extra components needed) included and are relatively cheep (I bought 37 for 10AUD). Other boards/circuits will be introduced to the I2C BRICKS.
The through-holes adjacent to the ATTINY85 have been left unused, to enable a pogo pin programmer while the DIP8 is soldered to the PCB.
A further abstraction, packaging the BRICKS in small cylinders that plug into a D1M WIFI BLOCK hub, pumping the values to a MQTT server, is being developed.
Step 1: Materials and Tools
There is a full Bill of Material and Sourcing list.
- Keyes KY-015 sensor (1)
- ATTINY85 20PU (1)
- 1" Double sided protoboard (1)
- Male Header 90º (3P, 3P)
- Male Header (2P, 2P)
- Jumper Shunt (1)
- Hookup wire (~7)
- Solder and Iron (1)
- Strong Cyanoachrylate Adhesive (1)
Step 2: Prepare the ATTINY85
AttinyCore from the Boards Manager is needed. Burn bootloader "EEPROM Retained", "8mHZ Internal" (all config shown above).
Use the included source; compile and program to the ATtiny85.
The GitHub repository is here:
The files can be downloaded here.
You may find more details in these instructables:
Best to test via breadboard before continuing.
If you have existing ASSIMILATE SENSORS, make sure the slave address is different on a SENSOR/MCU Host combination i.e. all the Temperature sensors can have the same address as long as you only have one Temperature sensor on a MCU/node.
Step 3: Assemble the Circuit
- On the front, insert the components ATTINY85 (1), 3P 90º male headers (2)(3), 2P male headers (4)(5), and solder off on the back. These may be glued to the PCB prior to soldering if you have adequate ventilation.
- On the rear, insert an end stripped black wire into BLACK1, tracing through to BLACK2 on the front. trace the other end of the wire from BLACK1 to BLACK3. Solders BLACK1, BLACK2 and BLACK3.
- On the rear, trace a black wire from BLACK4 to BLACK5 and solder.
- On the rear, insert an end stripped red wire into RED1, tracing through to RED2 on the front. trace the other end of the wire from RED1 to RED3. Solders RED1, RED2 and RED3.
- On the rear, trace a red wire from RED4 to RED5/RED6 and solder.
- On the rear, trace a green wire from GREEN1 to GREEN2 and solder.
- On the rear, trace a blue wire from BLUE1 to BLUE2 and solder.
- On the rear, trace a yellow wire from YELLOW1 to YELLOW2 and solder.
The sensor can now be connected directly via its pins to the PCB or via wires, to the points shown in the pin contract.
Step 4: Testing
A number of these BRICKS are expected to be on multiple nodes (MCUs - ESP8266 or ATTINY84) in an environment. This is a unit test: checks the UNO requests/responses until all the data has been dumped, then neglects the I2C slave.
- Upload the UNO code to your UNO test harness. Ensure ADDRESS_SLAVE matches the BRICK's I2C address.
- Connect the 3.3V or 5.0V on UNO to a VCC on BRICK.
- Ensure jumper for that pin is on.
- Connect the GND on UNO to GND on BRICK.
- Connect the A5 on UNO to SCL on BRICK.
- Connect the A4 on UNO to SDA on BRICK.
- Connect a 4K7 pull-up resistor from SDA to VCC.
- Connect a 4K7 pull-up resistor from SCL to VCC.
- Connect your UNO to your Dev PC with USB.
- Open the Arduino Console.
- Choose 9600 baud (restart the UNO and reopen the console if you have to).
- The Property Names and values should be printed to the console once then the word sleep is repeated.
The METADATA and Properties are shown in the console window.
Step 5: Next Steps
The basic layout of the circuit and the I2C layer of the software is relate-able to many different sensors. The main thing to get right to start with, is the packet contract between master and slave.
I have slated/started a (3D printed) packaged network of sensors that use this framework and will link to it as parts are published.
This BLOCK is used by the DHT11 ASSIMILATE SENSOR.
We have a be nice policy.
Please be positive and constructive.
Although there is a jumper to select the Voltage (3.3V/5.0V) on the BRICK, generally the master and the slave will have the same VCC. If not, an I2C Logic Level Converter will be needed.