homebrew processors and film camera love

Make Your Own – Part 3 – Main Board

Make Your Own – Part 3 – Main Board

The Theory

The Arduino Mega powers the main screen, timer interface and the relays for button lights and more importantly the motor for agitation. Imagine the whole code script as a flow chart for doing things in sequence.

Rough Setup Guide.

For the minute, in the code, I would just not connect pins 32-28 and forget about lightup buttons at present, just concentrate on getting the displays working, the timer working and the relay for the motor working.

Display 4×20

Connect the display to the IC2 pins, SDA, SCL 5V, GND, thats it, I’ll mention libraries further down.


You don’t need to wire up all the buttons if you just want to test it actually works, just do one or two. I’d suggest using 28 and 31 for mono dev and start button as these are easy to play with and you need the start button for all of them.

You don’t need resistors as we change them to PULLUP in the code.

7 Segment Screen for Timer

As with the temperature arduino, just connect the 5V/GND pins then Pins 8 and 9 for DIO/CLK and the rest is done in the script.

Relay for Motor

Even though I advise only using the 1 relay at present for the motor, setup is the same as any relay board, so you need a separate 5v supply for the relay and then you wire the ground to both GNDs (supply and arduino) BE CAREFUL TO REMOVE THE JD-VCC PIN JUMPER, THIS ISOLATES THE ARDUINO POWER FROM THE EXTERNAL POWER AND STOP THE RELAY DRAINING POWER FROM THE ARDUINO.

Connect the IN1 pin to pin 39 on the arduino just for the relay motor to test it works (you can connect to lights etc later) and wire up the motor to the relay with your external 12v power supply. (No diagram of this as its basic relay wiring)

*Note* – I would recommend playing with the relay with just the relay code on its own first to get used to how they work.

Temperature Sender Pins

Wire up from Pins 8 and 9 on the temp arduino to 24 and 25 on the MEGA, you’ll probably get them the wrong way round, I always do, not a worry at present.


OK, dependancies you need are, again in the files at the top of the page.

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include “SevenSegmentTM1637.h”
#include “SevenSegmentExtended.h”
#include <EEPROM.h>

Connect the Mega to your pc, select it in Arduino IDE and upload to the mega. If you have wired it up right, power up both arduinos (if working the temp arduino uno doesnt need to be connected to the pc, just Power and the 2 sender pins).

You should then be able to use only the start and mono dev buttons to select the basic program and start the relay motor (You’ll hear the relay click if it works) when agitation should occur. The timer should display time, and the main display the basic instructions. If it doesn’t work, please follow standard debugging methods.

Code Theory

The code I’ve used isnt’t complex, but there is alot of it. I’m no coder and hence I’ve kept it simple, if a bit long.

Most of my code uses simple ‘delays’ for the waiting for button presses etc, proper coders hate this, but I can’t get my head around ‘milli’ etc. I actually paid someone for the timer code so your getting this for free.

Below I’ll try and cover the main aspects of how the code works but you really need to learn the basics to understand how I’ve done it.

Information on the main LCD

This is the easy bit, heres an example

lcd.print("Mono Process");
lcd.setCursor ( 0, 2 ); // go to the 3nd line
lcd.print("Use Ilfosol 3");

In this example, we use the clear command everytime we want the screen wiped, then you print a line, then set the cursor to the next line and print again and so on. It’s that simple. Results are below

Button Presses

Example code

if (digitalRead(28) == LOW) {
//Button one is pressed!
lcd.print("Mono Process");
lcd.setCursor ( 0, 1 ); // go to the 2nd line
lcd.print("For KOSMO100 20c");
lcd.setCursor ( 0, 2 ); // go to the 2nd line
lcd.print("Use Ilfosol 3");
digitalWrite(Relay_1, RELAY_OFF);
digitalWrite(Relay_2, RELAY_OFF);
digitalWrite(Relay_3, RELAY_OFF);

To try and explain, the section if (digitalRead(28) == LOW) { shows the arduino awaiting the button to be pressed, connected to Pin 28. When pressed it will then do the rest of the options in the loop, in this example it prints some information on the display, turns the light relays for the other buttons off, and waits 5 seconds before running the Mono Program (which contains more button presses). They are quite linear and simple to setup, like I said, imagine a flow chart.

Most of my button code is just to trigger, or wait for a process loop to be called. Eg. To show information on screen, or to start a process.

Start button is awaiting being pushed (pin 31)

Motor Agitation

This code is simple in itself, create a program

void agitationOn() {
digitalWrite(Relay_6, RELAY_ON);
digitalWrite(Relay_8, RELAY_ON);

void agitationOff() {
digitalWrite(Relay_6, RELAY_OFF);
digitalWrite(Relay_8, RELAY_OFF);

The above just means that you can call ‘agitation on or off’ and the relay for the motor will turn on or off, note two relays are being used, the motor and the motor indication light. Thats it for the motor.

Motor Fitment

This will depend on how you setup your dev tank. In the prototype, its crude, setup as below.

The motor axle just connects to the ‘twiddle stick’ through a hole drilled and a bit of wire passed through to lock them together. Motor is hidden in a junction box on the top of the tank lid.