Week 10: Output Devices

Date: March 25 - April 1, 2026


What I Did This Week

I added output devices to my Reptile Monitor board and controlled them with code.

Output devices I used: - SSD1306 OLED display (128×64, I2C 0x3C) — shows sensor data in real time - Grove I2C Motor Driver TB6612FNG (I2C 0x14) — controls a blower fan

I read temperature and humidity from two SHT31 sensors (from Week 9) and made a system that turns the fan on automatically when it gets too warm.


Group Assignment: Measure Power Consumption

📎 Group Work Page

We measured the power consumption of a SG90 clone servo motor.

Tool We Used

We used a Qoitech Otii Arc. This device can supply power and measure voltage and current at the same time.

How We Measured

We replaced the power cable between the XIAO and the servo with the Otii Arc. The ground connection stayed the same. We used a clip to attach the Otii Arc ground cable.

Group measurement setup Measurement setup with Otii Arc

Measuring at PC Recording data on the PC

Probe connection Connecting the probe to the circuit

Probe close-up Close-up of the probe connection

Results

Item Value
Device SG90 clone servo motor
Peak current 403 mA
Control XIAO stepped the servo 1 degree at a time

The graph showed many current peaks. Each time the servo moved, the current jumped up.

What I Learned

  • A servo motor does not use a steady current. It uses a short burst of current each time it moves. The Otii Arc graph made this easy to see.
  • The peak current (403 mA) is much higher than the average current. This matters when planning a power supply — I need to design for the peak, not just the average.
  • The Otii Arc can supply power and measure at the same time. This is more convenient than using a separate bench power supply and multimeter.
  • I need to plan power budgets for my final project. The fan and servo motors will have different peak currents at different times.

Individual Assignment: Output Devices

What I Built

I connected an OLED display and a motor driver to my Reptile Monitor board.

  • The OLED shows temperature and humidity from both sensors in real time
  • The fan turns ON when temperature goes above 27°C
  • The fan turns OFF when temperature drops back to 27°C or below

This is a prototype of the fan control system for my final project (Smart Reptile Habitat System).


Step 1: Parts

I used two output devices this week.

  • SSD1306 OLED display (128×64 pixels, I2C)
  • Grove I2C Motor Driver TB6612FNG (2-channel DC motor, I2C address 0x14)

I connected all four I2C devices (SHT31 ×2, OLED, Motor Driver) to the same I2C bus.

Components Reptile Monitor board, SHT31 sensors, and I2C Hub

Output devices Motor Driver TB6612FNG, blower fan, and OLED display


Step 2: Wiring

I connected all devices with I2C. On the XIAO ESP32C6, the I2C pins are D4 (SDA) and D5 (SCL).

Device I2C Address Connection
SHT31 bottom 0x44 Grove I2C connector J3
SHT31 top 0x45 Grove I2C connector J3
OLED SSD1306 0x3C Breadboard
Motor Driver 0x14 Grove I2C connector J3

I connected the fan to MOTOR_A on the motor driver.

Wiring complete Complete wiring


Step 3: Code

I wrote the code in Arduino IDE for the XIAO ESP32C6.

Libraries I used: - Adafruit SHT31 Library - Adafruit SSD1306 - Adafruit GFX Library - Grove Motor Driver TB6612FNG (installed from ZIP via GitHub)

Fan control logic: - 27°C or below → Fan OFF - Above 27°C → Fan ON (full voltage)

I first tried PWM speed control, but the fan would not start at low duty cycles. It needs full 5V to spin. So I changed to ON/OFF control.

// Fan ON/OFF based on temperature
if (fanSpeed > 0) {
    motor.dcMotorRun(MOTOR_CHA, 255);  // Full speed
} else {
    motor.dcMotorStop(MOTOR_CHA);
}

Arduino IDE Arduino IDE 2.3.8 — code and serial monitor output. Both sensors send data every 2 seconds.


Step 4: Test

The OLED shows temperature, humidity, and fan status in real time.

Overview Full system overview — Reptile Monitor board, sensors, motor driver, and fan

OLED display When temperature rose above 27°C, the fan turned ON correctly.

Fan and motor driver Motor Driver TB6612FNG and blower fan

I used a heater to raise the temperature above 27°C and confirmed the fan turned ON. When the temperature dropped, the fan turned OFF.

Fan ON/OFF test — the fan starts when temperature exceeds 27°C.


Design Files

File Description
Reptile_Monitor_Output.ino Arduino sketch

Connection to Final Project

This week's work is a key part of my final project.

  • OLED display → shows habitat status in real time
  • Fan auto control → ventilates when temperature gets too high
  • I2C Motor Driver → can also control a motor to open a lid in the future

What I Learned

  • DC fans need full voltage to start. PWM control did not work for this fan.
  • The Otii Arc is a very useful tool for power analysis.
  • When using many I2C devices, I need to check that each device has a different address.

References


Last updated: April 1, 2026