Skip to content

Quiz buttons

Files

Salvaging old project

My old project was in a state. Everything was still connected and ready to work, with the exception of lights. The light I had were 12V 1,5W bulbs with car like connectors.

The things that were completed previously were:

  • The plans
  • Most of the code
  • The housing

The plans

The plan was to house buttons and lights on wooden domes, that were connected to a central Arduino Micro via RTTS audio cables (chosen as they are simple and cheap wires that can transit 4 pins.) Arduino Micro is then connected to a computer, and will send keyboard signals to it when the buttons are pressed.

The code

The code was mostly already written. It was the easy part. It can be found from the top of this page. The code is based on multiple classes, and the relevant logic is abstracted under each of them:

Main runs the main loop and initializes the Buttons.

Button setups correct pin for listening the button press, and listen for the pin. Also remembers which light is connected to which button.

ButtonGroup groups all buttons together, so that managing mulitiple buttons is easier. Updates and manages all Buttons.

LightController handles the logic for turning the light of each button on and off. This is separated into its own class and not part of Button or ButtonGroup because:

  • The logic is easier to change.
  • It is all in one place.
  • It is not intermingled with other logic.

Pins.h defines the pins for each purpose.

The only thing that the code needed, was to change the keyboard logic to take the locking state into account. When another button is pressed, no other button should be able to be pressed in 5 seconds. Originally, I wrote the code so that the computer could react to the wrong button presses as well, but it would be nice, if the computer would at least know if the button press was valid or not.

The current logic does not allow for a good communication between the LightController and the Button, so that the LightController could prevent Button from sending a Keyboard press, or at least change it to somethig else. That part would need to be changed.

The housing

During woodworking last year, as my first woodworing project, I made couple of domes that could house the buttons, the wiring and the TRRS female connector.

The process for creating them was not the smartest, and in hindsight, I think the opposite order would have made more sense. Originally I started with a big pile of planks glued together in a 30cmx30cmx120cm block. Them I lathed it to a circular block, sawed the block into 5 similar sized solid cylinders (around 25cmx25cmx25cm). I even managed to bend a band saw blade while doing this, because sawing a cylindrical block is very stupid. Then I lathed and sanded them again to get the correct domish shape. When the shape was good, I drilled the cavity for the electronics.

Or at least I tried to.

Because I had lathed the piece to a dome shape, it was almost impossible to get the piece to stay put while drilling, especially with bigger drill bits, as the torgues would loosen the piece and it would fly across the floor. I had to use a small bit, and hand carve the rest to make a good cavity. At least the top hole for the button went well.


New things

There were still things to do, including:

  • Soldering the TRRS female heads to the board and to the housing
  • Housing for the main hub
  • Board for the main hub
  • Power transmission to the 12V light bulbs

Soldering

To start the soldering, I needed to figure out where each pin needed to connect to. To solve that issue, I used a multimeter to measure which pin of the female head matched with which pin on the male head. Then I just randomly mapped each pin to each function.

The I started soldering. Soldering that requires 4 hands is difficult. I used clamps to keep both the wire and the connector in place.

Housing

This could be simple laser cut box. Will do it once the board is finished.

Board

How to design these is taught in two weeks. Hopefully I can get it to work then.

PCB steps, two weeks later

Power transmission

I had already bought ULN2003 transistor for this purpose. It could complete lamp’s circuit to ground when given correct signal, and I had figured out how it worked two years prior. Now I had completele forgotten how it works, so I needed to relearn it. For some reason, I had disconnected the pins from my breadboard around the ULN2003, so I could not use those as a reference.

After consulting some documentation and asking for help, I figured it out again. I cannot understand why the pin that takes in the controlled current is called output pin in the documentation, but this is the world that we live in. In the end, I connected the ground wires of the lamp to the ULN output pins 13-16, the signal wires from the Arduino board to the input pin 1-4 and the battery anode to the common ground pin 8.

The people have seen a great light.

The final project seemed to work:

There were some problems with the lamps short circuiting. Most likely it had something to do with the wire mess that was the breadboard.