Motoring on through!

At the beginning of the run, the ball sits at the bottom of the run awaiting the elevator to turn on and carry it to the top. This was the simplest solution for having a single run setup. In order to start and stop the elevator component, the motor needed to be modified so that it could be controlled by the arduino.

There were two ways to do this. As the motor consisted of a power source and a switch we could have done one of the following:

  • Disassemble or replace the switch, allowing the arduino to control the power flow
  • Attach new wires to the power source input and use the arduino to power the elevator leaving the switch always on.

In the end, I decided to go for the latter mainly because I would be able to use the whole elevator/motor system as it was manufactured in the future should I wish whereas with the first method I would have always needed an arduino.

The process of doing this was simply soldering on additional wires, drilling a small hole in the housing to allow them to come out and then connecting these to the arduino. The option did have the added difficulty that we had to use a PWM pin in order to provide the correct amount of power and a transistor to make it into direct current. The results were what we envisaged and this part of the project worked faultlessly from the start.

Break a beam!

Well, not quite don’t break a leg but it’s close!

 

An integral part of the project was detecting where the ball was and whether it had passed a certain point or not. In order to do this I used some phototransitors coupled with some IR emitters as an improvised beam trip. When the ball passes between the phototransistors and IR emitter the arduino is able to detect the slight drop in the readings which indicates the ball has travelled past. This meant that we could flip booleans in the logic to indicate where the ball was in the system.

We had a slight issue with the bouncing of the sensors because occasionally the light levels would fluctuate and due to the fact the phototransistors detect a much wider range of light than an IR detector, it would occasionally simulate tripping the beam. To ensure this really was a ball passing through I wrote a small segment of code to ensure that the beam break time was synonymous with a real break.

Once I had created a working prototype on the breadboard I then created several smaller beam break modules using small squares of stripboard. These were mounted onto the small clips that held the track together and then the Emitter and phototransistor were aligned for best results.