Pine

🌲 Indoor Infrared receiver and transmitter with temperature sensor 🎐

power AA
wireless Infrared
mcu SAMD21G18
bom items 49
bom cost USD $9.71
vendors 2
completed September 2020

Mechanical sizes

Item Height Width Depth Weight
Battery holder for 3AA enclosure 57.7 mm 47 mm 16.6 mm 9.4 g

Sub-system design

Subsystem design

Terminologies

  1. Device - Pine, the entire electronics with embedded firmware and associated software
  2. Ideal temperature - Desired room temperature as configured by the first-time user
  3. Power on - A DPST switch to power on the entire device
  4. Power off - A DPST switch to power off the entire device
  5. Start button - A push button to start the device function every interval for a duration of time
  6. ON command - Array of raw IR code to turn on the aircon at a certain temperature
  7. OFF command - Array of raw IR code to turn off the aircon
  8. Interval - Time period after which the device will check for room temperature and turn on or off the aircon E.g. 30 minutes
  9. Duration - Length of total time during which the device will start functioning and then stop until it is started again
  10. Ideal temperature - Desired room temperature as configured by the first-time user

User Stories

First-time user


As a first-time user, I want to save the ON command of the aircon remote controller so that it can be stored and replayed.

As a first-time user, I want to save the OFF command of the aircon remote controller so that it can be stored and replayed.

As a first-time user, I want to configure the interval time for checking the room temperature so that it can wakeup periodically to check the temperature.

As a first-time user, I want to configure the total period of time when the device should be checking the temperature so that it can stop checking the temperature to regulate the room environment after a while.

As a first-time user, I want to configure the ideal room temperature so that it can turn ON/OFF the aircon according to the measured temperature.

User


As a user, I want to turn ON the device with an on-board button so that it can measure the current temperature and turn ON/OFF the aircon periodically.

As a user, I want to turn OFF the device with an on-board button so that it can measure the current temperature and turn ON/OFF the aircon periodically.

As a user, I want to replace the battery so that the device can be powered again.

As a user, I want to turn ON the aircon automatically so that the room becomes cooler towards my ideal temperature.

As a user, I want to turn OFF the aircon automatically so that the room becomes warmer towards my ideal temperature.

As a user, I want to place the device on a vertical surface in line of sight with the aircon so that it can send the ON command to the aircon.

As a user, I want to know whether the room temperature is colder or warmer than the ideal temperature through an on-board LED so that it can send the OFF command to the aircon.

State Machine

Edit state_machine.md at mermaid js live editor.

State Machine

Required features

  1. Store 2 arrays of about 300 elements of 12-bit integer for raw IR code
  2. Flash in a program with sufficient memory containing IRLib2 with both IR emitter and receiver, compression algorithm. Sketch uses 5476 bytes (16%) of program storage space. Maximum is 32256 bytes. Global variables use 2156 bytes (105%) of dynamic memory, leaving -108 bytes for local variables. Maximum is 2048 bytes. Not enough memory; see Troubleshooting Guide for tips on reducing your footprint.
  3. Sleep and wakeup periodically with a timer
  4. Support Web USB protocol
  5. Support I2C protocol for temperature sensor

Aircon compatibility for IR protocols

Options for both supported and unsupported IR protocols are available.

  • Supported protocols: Check IRLib2 supported protocols
  • Unsupported protocols: Record the IR raw code.
  • Example of unsupported protocols: Mitsubishi Aircon remote Example aircon model for unsupported protocol

Power consumption of main components

Chip # Description Operating Voltage Output Voltage
SAMD21G MCU 1.62V to 3.63V
TSOP4383 IR Receiver 2.5V to 5.5V
SIR-56ST3F IR LED Emitter 1.3V to 1.6V
Si7021-A20 Temperature and humidity sensor 1.9V to 3.6V
LD3985 Low dropout voltage regulator 2.5V to 6.0V 1.22 V, 1.8 V, 2.5 V, 2.6 V, 2.7 V, 2.8 V, 2.9 V, 3 V, 3.3 V, 4.7 V

Circuit simulation

Simulation of the power management circuit with Falstad [File > Import from Text].


Download code
$ 1 0.000005 10.20027730826997 53 5 43
R 48 192 48 128 0 0 40 5 0 0 0.5
s 48 192 160 192 0 0 false
x -22 190 27 193 4 24 USB
r 336 192 448 192 0 1000
g 448 192 448 240 0
f 320 352 320 304 41 1.5 0.02
w 240 352 320 352 0
w 336 256 336 304 0
R 48 304 48 272 0 0 40 3 0 0 0.5
s 64 304 160 304 0 0 false
w 224 304 304 304 0
r 320 352 448 352 0 10000
g 448 352 448 384 0
d 240 192 304 192 2 default
w 304 192 336 192 0
d 336 256 336 208 2 default
w 336 208 336 192 0
w 240 192 240 352 0
x -46 298 27 301 4 24 battery
w 160 192 240 192 0
w 160 304 224 304 0
w 64 304 48 304 0
Power management circuit simulation

SAMD21 vs ATmega328p

SAMD21 ATmega328p
Arduino board Arduino Mkr Zero Arduino UNO Rev3
Flash (usage) 256 kB Flash (program and config) 32 kB Flash (program)
EEPROM (usage) no EEPROM 1 kB EEPROM (config)
RAM (usage) 32KB (variables) 2KB (variables)
RTC 32-bit
Sleep modes IDLE / STANDBY (Section 18.6.8 Sleep Mode Operation)
USB USB 2.0 host and device interface
I2C true true