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 interpretation by the 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
None Off Awaiting next command
Yellow Steady Awaiting a further key press to complete current command
Yellow Four quick blinks Timed out waiting for key press to complete current command (immediately returns to waiting state)
Green Single long blink Command entered correctly (returns to waiting state after fixed number of flashes)
Red Four quick blinks Erroneous command (returns to waiting state after fixed number of flashes)
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

An infra red sensor and remote controller have been obtained. 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 IRRemote library has been tested and will be used to interpret commands from the handset.

After testing both serial and I²C communication between microcontrollers, it has been decided to use I²C.

An experiment has been carried out to determine the values of resistors that need to be used with the red, green and blue elements of the LED to balance the colours it displays.

A circuit for the subsystem has been drawn up. It is sub-divided into two modules, as the following circuit diagram shows:

IR control sub-system circuit design

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

Note that ir-control.cpp has several dependencies that need to be resolved before compiling. Opening the /src/ir-control directory in VSCode (with PlatformIO installed) and compiling from there should take care of the dependencies.

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

It was originally hoped to house the entire circuit within the 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 IR control receiver module as built on perf board, almost ready for adding to the case. The upper component is the IR receiver itself and the lower component is the RGB feedback LED with attached resistors. The sensor board is angle to abut the LED board when mount in the case, with the LED board on top. The four wires on the left of the picture will be 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 show the case with the components installed and held in place with hot glue. The runners on the case fit in a slot on the front of the diorama baseboard to enable the case to be slid into place.

IR control receiver module in case

Back to diorama home page