Pine

🌲 An indoor infrared receiver and transmitter with a temperature sensor 🎐

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

Why "Pine"?

Inspired by the resilient pine tree, which stays evergreen and adaptable, even as seasons and temperatures shift.

Sub-system

Subsystem flow chart

Mechanical sizes

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

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

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