Toothbrush Timer With Mathquiz

by rgco in Circuits > Arduino

2622 Views, 39 Favorites, 0 Comments

Toothbrush Timer With Mathquiz

20160403_090716.jpg
20160403_090552.jpg

This was my first Arduino project, and since the prototype was quite a success with the children, I soldered a permanent version. Since our bathroom has no accessible power plug, I made it battery powered.

Brushing the teeth is expected to take 130 seconds: 30 seconds each for each corner and 10 seconds for the tongue. An animated toothbrush reminds which stage you are. After one minute a true/false math question will be asked. Only by answering correctly and continuing to the end a point will be earned. The difficulty of the math questions will go up when 4 questions have been answered correctly (or down after two consecutive mistakes). The scores and levels are kept in EEPROM for 4 users.

Battery power is boosted from rechargeable Ni-MH AA batteries to 5V. I went for 2 AA batteries in the final version to keep it compact. It goes in sleep after a few minutes of disuse and will wake-up at any pushbutton, however, both the Arduino and the power booster have a small LED that will drain the batteries in a few days. I did not try to remove or disable the LEDs and instead chose for a hard on-off switch between the battery and the power booster. This way, being used up to six times a day for ~ 3 minutes, the 2 AA Ni-MH batteries have already lasted more than a month.

Components

20160403_093921.jpg

For the prototype:

1 Arduino Uno compatible with USB cable (2.33GBP)

1 USB power bank 2000mAh

1 8x8 LED matrix with MAX7219 driver (1.11GBP)

1 Prototype shield with 170point mini-breadboard (1.24GBP)

6 momentary push-buttons (100 for 0.99GBP)

30cm solid-core hookup wire (10m for 2.10GBP)

For the soldered version

1 Arduino pro-mini Atmega328 5V (1.01GBP)

1 8x8 LED matrix with MAX7219 driver (1.11GBP)

1 Battery holder 2xAA with leads (5 for 1.05GBP)

2 AA batteries

1 0.9-5V to 5V DC-DC booster (5 for 1.30GBP)

2 7x5cm prototype 'paper' boards (10 for 0.99GBP)

4 nylon M3 spacers 20mm, with matching screws (4) and nuts (8) (2.19GBP for 180pcs)

6 momentary push-buttons (100 for 0.99GBP)

1 on/off switch (e.g. 6-pin vertical DIP slide 20 for 0.99GBP)

40cm solid hookup wire (10m for 2.10GBP)

solder

2 rubber bands

All components are standard andcan be found cheaply online.

Parts cost are ~5GPB for the prototype, 3GBP for the soldered version

Assembling the Prototype

toothbrushtimer_prototype_bb.png

Sorry for the poor quality schematic. Just downloaded Fritzing for the first time today.

Connections should be straightforward. Note the following:

Pushbuttons are active-low so should be connected to ground (using the internal pull-up resistor of the Arduino)

Read carefully the pins of the LED/7219 module. My module has VCC/GND/DIN/CS/CLK while many examples suggest VCC/GND/CS/CLK.

Unless you want to add sound, realtime clock, battery level, the buttons and LED matrix can be connected to any Arduino pin (but avoid D0, D1 and D13), whatever fits the layout best, it's straightforward to adjust in software.

Making the Soldered Version

20160403_110137.jpg

Widen the holes of on the corners of both PCBs till the nylon screws fit through them.

Solder the 6 push buttons and the on-off button on the PCB.

Remove the USB connector from the DC-DC power booster and break off the empty PCB below it.

For the pro-mini, stick the pin-headers with the long pins down on the PCB. Now fold the pins on the bottom side alternatively to the left and to the right. This way it will be fixed well to the PCB without soldering the long pins. Lay the pro-mini on the short pins and solder the pins to the board.

Solder the 5 pins of the 7219/LED matrix module on the PCB. Use the supplied 90-degree pin header to have it stand vertical.

Prepare the hookup wires and solder all connections. It doesn't matter to which of the 20 IO pins the buttons and LED matrix are connected since it can be set in software.

Finally, connect the two leads of the battery holder to the on/off switch.

After uploading the software, complete the unit by mounting it on top of a second PCB with nylon spacers. The batteries fit in between and can be kept in place with two rubber bands.

Uploading the Code

For the prototype, the code can be uploaded directly through the USB connector.

For the pro-mini, which doesn't have a USB-TTL converter on-board, you can use a spare Arduino. Connect RESET to GND on the full Arduino and then GND->GND, 5V->5V, TX->TX, RX->RX. 4 jumper wires from the Arduino to the pro mini will do if you push them a bit on the pro-mini to keep good contact during the upload.

In the program, make sure to set the correct values for the pin numbers that the buttons and the LED matrix are connected to. Also, change the names to the names to those of your family.

The program uses EEPROM to keep the scores. This means it can be safely switched on and off without loosing score info. The program as is resets the scores. This is needed the first time it runs. When the program has run once, re-upload it with line 139 (setEEPROM()) commented out, otherwise it will reset the scores every time it runs.