I have been collecting (rare) LEGO electronics for some time now. My collection includes various things from the 1980's to now, including the predecessor to the LEGO interface B: the interface A.
Since recent I have been spending time getting the interface B to work from a modern PC with python (see my ongoing interface B projects on my dashboard). This made me want to get my interface A working with modern hardware.
Let's get started!However unlike the interface B, the interface A has absolutely no computing or logic going on. It is basically a box with a IDC 20 pin connector and 9 4.5v ports.
You drive the interface A by pulling certain pins HIGH or LOW on the 20 pin IDC connector. 2 other pins show the state of the binary sensor inputs. It is really simple.
The interface A has 9 ports: 1 always on 4.5v power port, 3 pairs of 2 motor/light ports and 2 sensor ports. I say "2 pair of" because you can attach devices to individual ports or 2 ports at once, so you can have mono-directional outputs (0, 1, 2, 3, 4 and 5) or a bi-directional outputs (A, B and C). see the bellow picture:
To exactly know what pins are connected to what outputs I did a little bit of research, luckily for me a lot of people have build arduino-interface A interface's before me, so I could just copy-paste there findings, see the sources below!
As you can see, everything is quite simple:
- interface A sensor port 6 is on IDC pin18 goes to arduino pin 15
- interface A sensor port 7 is on IDC pin20 goes to arduino pin 16
- interface A motor port 0 is on IDC pin6 goes to arduino pin 3
- interface A motor port 1 is on IDC pin8 goes to arduino pin 5
- interface A motor port 2 is on IDC pin10 goes to arduino pin 6
- interface A motor port 3 is on IDC pin12 goes to arduino pin 9
- interface A motor port 4 is on IDC pin14 goes to arduino pin 10
- interface A motor port 5 is on IDC pin16 goes to arduino pin 14
I tried to use all PWM pins for the motor outputs, however I am 1 pin short, I had to use pin 14 for the last port on the arduino.
Programming:Programming is extremely straight forward. I first assign my I/O to the correct input and set the inputs to zero:
// i/O of the interA
const int input6= 15;
const int input7= 16;
const int output0= 3;
const int output1= 5;
const int output2= 6;
const int output3= 9;
const int output4= 10;
const int output5= 14;
int I6state = 0;
int I7state = 0;
void setup() {
// put your setup code here, to run once:
pinMode(input6, INPUT);
pinMode(input7, INPUT);
pinMode(output0, OUTPUT);
pinMode(output1, OUTPUT);
pinMode(output2, OUTPUT);
pinMode(output3, OUTPUT);
pinMode(output4, OUTPUT);
pinMode(output5, OUTPUT);
}
Then in the void loop() you can start programming like any other arduino project.
In the example code in the bottom I have made a simple sketch to drive a motor via a poteniometer.
Conclusion and what is next:One of the things I like to do is to create a simple program in python with GUI to manually drive every motor and read the state of the inputs. I also would like to create some sort of "api" to make custom python scripts for the interface A.
One of the challenges is however is to find a way to drive multiple outputs simultaneously with different speeds. this would allow for more complex creations and proper CNC action.
credits:
Comments