Version 9 by Stephane Carrez
ProjectEmbedded Bathroom Control System
Date 2001 - 2004
Goals Control the fan, light, radio in a bathroom based on presence, temperature and humidity
Dependencies [[VACS:Projects:Software:Gnu68hc1x


The Embedded Bathroom Control System is a small system based on a 68HC11 and designed to:

  • Control the bathroom fan,
  • Control the light,
  • Control the radio (ie, music),
  • Display the temperature, humidity, ...

This system has several hardware components:

  • A 68hc11 board with 32Kb of ROM and 32Kb of RAM. This board runs the EBCS software.
  • An LCD board which provides a 2x16 LCD display with 4 buttons.
  • A Power Control board which has a transformer and 2 triacs (one for fan and one for light).
  • A Sensor module which provides temperature, humidity and presence detection.
  • A I/O board connected to the CPU board. This is the interface with the sensors, the power control board and the LCD panel.

EBCS Components

IO Board

The IO board:


Documentation on the chips used by EBCS IO board.

Documentation (1)
4xxx/CD40106.pdf Hex schmitt triggers
4xxx/TL071.pdf Low Noise Single J-FET operational amplifiers
vreg/L7800.pdf Positive voltage regulator (7805, 7812, 7815, ...).
transistors/BD140.pdf PNP Silicon Transistor
transistors/BC237.pdf NPN Epitaxial Silicon Transistor
transistors/BC557.pdf PNP Epitaxial Silicon Transistor
aop/TL071.pdf Low Noise J-FET Operational Amplifier

(1) Documentation publicly available on various constructor web sites and copied here for archiving.

Power Supply and Triacs Board

The power control board:

EBCS Power Board

Documentation on the chips used by EBCS Power board.

Documentation (1)
triacs/BT137.pdf Triacs (I've used a BT137-600).
triacs/moc3041.pdf 6-Pin DIP Zero-Cross Optoisolators Triac Driver Output
transistors/BC549.pdf NPN Silicon Transistor
transformers/myrra_45000.gif Transformer (http://www.myrra.fr: Myrra ).
opto/4N35.pdf Optocoupler with Phototransistor Output

(1) Documentation publicly available on various constructor web sites and copied here for archiving.

LCD Board

The LCD panel with 4 optical buttons.


Documentation on the parts used by EBCS LCD board.

Documentation (1)
lcd/hd44780u.pdf Dot Matrix Liquid Crystal Display Controller/Driver
4xxx/CD4001.pdf Quad NOR gate
4xxx/CD4081.pdf Quad AND gate
aop/TL071.pdf Low Noise J-FET Operational Amplifier
74xxx/74HC164.pdf 8 Bit Sipo Shift Register
74xxx/74HC273.pdf Octal D Type Flip Flop With Clear
transistors/BS170.pdf N-channel vertical D-MOS transistor
opto/CNY70.pdf Reflective Optical Sensor with Transistor Output

(1) Documentation publicly available on various constructor web sites and copied here for archiving.

68HC11 Board

EBCS Simulator

Since EBCS is installed in the bathroom, and to help in the development of the software, I wrote a simulator program that simulate EBCS completely. The simulator is composed of two parts:

  • A graphical part based on GNU Gtk is the simulator interface. It simulates the LCD panel, the optical keyboard buttons, the temperature and humidity sensors and show the status of the fan and light controlled by the system.

    The Gtk tool only simulates the I/O boards. It does not simulate the 68HC11.

  • A 68HC11 simulator which is part of GNU GDB. The GDB's simulator is very complete because it simulates all 68HC11 instructions and most of the 68HC11 IO devices (interrupts, I/O ports, timer, SPI, SCI, input/output compare, Analog inputs, eeprom, nvram). It is also accurate in the sense that it takes into account the CPU cycles taken by each instruction.

EBCS Design

The Gtk frontend and the 68HC11 simulator communicate and synchronize themselves using two mechanisms:

  • A shared memory segment is used to represent the I/O ports
  • A TCP/IP connection is used to synchronize the CPU with the frontend when the CPU writes on an output port.

The CPU always reads input ports in an asynchronous manner, that is, it never waits for the frontend to give the information. Synchronisation only occurs when the CPU changes an output port.

The screen shot below shows the simulator window with EBCS 0.6 running.

EBCS Simulator

The Gtk frontend was designed using Glade, the Gtk window editor.

2002-03-09http://www.vacs.fr/cas/ebcssim-0.2.tar.gz ebcssim-0.2.tar.gzAdd light simulation, fix some problems, includes gdb-5.2 patch for EbcsGdb HC11 simulator connection
2001-10-15http://www.vacs.fr/cas/ebcssim-0.1.tar.gz ebcssim-0.1.tar.gzFirst version; simulate LCD, buttons, fan and connects to GDB-68HC11 simulator


EBCS is a long term project started in 1998 while I was doing the plumbery and putting up the tiles in my bathroom. I had the idea to have the bathroom elements automatically controlled by a small system. It was just for fun, and for the interest in doing that.

This project depends on two others project that I started. First, I needed a C compiler, so I ported the GNU Development Chain for 68HC11. Second, I needed to burn an eprom, so I designed my own eprom programmer. Well, all this explains why it took so long to get it in my bathroom (3 years!!!).

Feb 24, 2002 Installation of EBCS v0.6 in the bathroom (compiled with GCC 3.0.3).
Jan 13, 2002 Installation of EBCS v0.5 in the bathroom (compiled with GCC 3.0.2).
Nov 24, 2001 Installation of EBCS v0.4 in the bathroom (compiled with GCC 3.0.2).
Aug 2001 Design EBCS software for controlling LCD panel and triac board, measuring temperature and humidity.
Jul 2001 Burn first Eprom for EBCS (not installed in bathroom yet).
Mai 2001 Made the EBCS sensor module.
Apr 2001 Design the EBCS Sensor module.
Sep 2000 Made the PPEP board.
Aug 2000 Design the PPEP to burn the 27256 EPROM of EBCS.
March 2000 Made the Power control, I/O board and LCD module.
Jan 2000 Design the EBCS LCD module with Eagle.
Dec 1999 Design the EBCS I/O board with Eagle.
Nov 1999 Design the EBCS Power control module with Eagle.
Mai 1999 Made the 68HC11 board, tested with bootstrap mode and 8K ram.
Apr 1999 Preliminary version of the C compiler, assembler, linker, debugger and simulator (arround GNU tools).
Nov 1999 Design of my 68HC11 board with Eagle.
Aug 1998 Preliminary idea to create EBCS arround a 68HC11 (need a board, sensors, a C compiler, ...)