Diorama: Infra-red Control In progress

The infra-red control sub-system enables all the diorama‘s features to be controlled using an infra-red handset.

Requirements

  1. An infra-red receiver should be placed on the front of the diorama as unobtrusively as possible.
  2. A simple infra-red handset should be used, with as few key presses as possible being used to enter the commands.
  3. The IR sub-system should interpret and encode the commands for transmission to diorama's main microcontroller.
  4. There should be some visible feedback given to the user as commands are entered. The following states need to be reported:
    1. Waiting for a command
    2. Valid command entered
    3. Further input required
    4. Erroneous command entered

Design

The infra-red control sub-system will have its own microcontroller that will communicate with the central control microcontroller.

Visual feedback to the user will be by means of and RGB LED that displays as follows:

LED Meaning
Colour State
Blue Steady System initialising. Not ready for commands.
N/a Off Awaiting the next command.
Yellow Steady Awaiting a further key press to complete the current command.
Yellow Four quick blinks Timed out waiting for a key press to complete the current command.
Green Single long blink A command was entered correctly.
Red Four quick blinks Erroneous command.
Blue Single short blink Input acknowledgement. The input is well formed, but may or may not be valid.

A regulated 5V supply and ground connection will be required from the diorama’s power supply.

Progress

Circuit

An infra red sensor and remote controller were obtained together. The handset uses the common NEC protocol.

It has been decided to use an Arduino Nano R3 clone as the microcontroller.

Note: it was originally hoped to use an ATtiny85 microcontroller, but problems getting a suitable IR receiver libray to work meant that this plan was abandoned. No such problems were found when using the Nano.

The circuit for the subsystem is sub-divided into two modules, as the following circuit diagram shows:

IR control sub-system circuit design

The values of the current limiting resistors were chosen to get the best colour balance from the RGB LED. The resistances were arrived at by experiment. The RGB LED is powered directly from the Nano's digital pins because the LED's power consumption is within the Nano's tolerances.

The decision to use I²C for communication with the central microcontroller was arrived at after testing both serial and I²C communications.

Software

A program to run on the microcontroller has been designed and tested. This program is available from the cahamo/diorama project on GitHub. It can be found in the /src/ir-control directory. The main file is ir-control.cpp.

After testing the IRRemote library was chosen to interpret commands from the handset.

The program was developed in VSCode using the PlatformIO extension. Compiling from within VSCode will resolve all library dependencies automatically.

Sensor Module Housing

A small plastic case, recovered from a defunct power supply, was adapted to house the Sensor Module component of the above circuit. The front of the diorama was modified to accomodate the case such that it can been removed for repair if necessary. The Control Module part of the circuit will be located underneath the diorama.

It was originally hoped to house the entire circuit within this case, but the decision to use an Arduino Nano clone instead of an ATtiny85 makes this impossible since the Nano will not fit in the case.

The following is a photo of two parts of the sensor module as built on perf board, almost ready for adding to the housing. The upper component is the IR receiver itself and the lower component is the RGB feedback LED with attached resistors. The four wires on the left of the picture were threaded through a hole in the back of the case and routed underneath the diorama baseboard.

IR control receiver module circuit as built

This second photo shows the housing with the components installed and held in place with hot glue. The runners on the case were made from coffee stirrers. They slide into a slot on the front of the diorama baseboard.

IR control receiver module in case

Back to diorama home page