Shorting bumpers¶
Components
- RP2040 micro controller
- Quentorres board
- Copper foil tape
- Wire
This is one of the designs I tested during input week to detect balls in a bumper.
Idea behind this was to make the simplest input system that I could, with as little moving parts as possible. Connecting two copper plates with the steel ball, and connecting those plates to input pin and either voltage pin or ground pin (depending whether the input pin is pulled up or not) seemed to fit the bill.
First I wrote a code to detect inputs from any switch like assembly. I wanted to use Serial Plotter to see the input events, so I needed to write things with ´Serial´. Serial was a bit too fast when running unconstrained in the loop()
, so I slowed it down by only printing data every 100 000 loops. This system is better than normal delay, because this still checks inputs every loop, and prints high if it has detected a single input high during the 100 000 loops.
Similar thing would probably have been possible with interrupts, but I was too lazy to figure if interrupts work with delays or not. So I just did the easiest system imaginable.
The test source code
int input_pin = 28;
void setup() {
pinMode(input_pin, INPUT_PULLUP);
Serial.begin(115200);
}
bool has_been_high = false;
int loop_count = 0;
void loop() {
int result = digitalRead(input_pin);
if (result == LOW) {
has_been_high = true;
}
if (loop_count == 100000) {
Serial.println(has_been_high ? "1" : "0");
loop_count = 0;
has_been_high = false;
}
loop_count += 1;
}
I did not need to print anything for this, I just attached a couple of copper foils to the bumper core that I already had printed, and soldered wires to it. I used the same vinyl cutting model that as I had used with the step response, but before cutting, I removed the line separating the two circles, so now I had one big circles. Now when a ball rolls to the core, it connects the plates and the pins.
I wired the two copper foils to a Quentorres board I had made previously, one connected to the V5 pin and another to in input pin.
At first, my code used just pinMode(input_pin, INPUT)
. That caused all sorts of false readings with the data, even tilting the solenoid caused the input pin to activate. The wire probably took some kind of interference from somewhere. It was fixed by changing the pinMode
to INPUT_PULLUP
.
After I fixed that, I could start testing the detection with the steel ball. It was extremely unreliable, only detecting about 50% of the hits. It could detect slower moving ball with more accuracy, but any kind of fast moving ball caused it to often skip the detection.
Only if there was a way to slow the ball down when it was close to the bumper.
What about magnets¶
Magnets could slow the ball down by trapping it. What if I hid a magnet inside the bumper core, and when the ball would be caught, there would be more time for the short to happen.
In Fusion, I started with the base for the bumper that I had completed previously. I started a new sketch on its top surface, and drew a circle in the middle of it. I had measured the magnets in our lab to be about 12.6mm in diameter, so I made the hole 13mm to account for the elephants foot and to make inserting easier.
I extruded the hole -underhatDistance - paddleHeight
in order to get the distance to reach the intended table surface. I could have also done this by extruding up to the surface at y=0, but as I had calculated everything else in the model without using defined surfaces, doing so here would have been weird.
The assembled contraption looks similar to the previous one without a magnet. This time there appears to be a hole on the top. But there is also a magnet in that hole.
When testing, the micro controller detect the ball now much more reliably. There are times where the ball comes too fast and bounces off, where it is not detected, but otherwise this seems like a sensible solution.
I’m not really happy with this design either, because even this design requires a micro controller per bumper. The input signal is too segmented to drive a relay and a solenoid all by itself.
I chose to go with this design in the end, and I designed the PCB and the 3D printed model around it.