During our seminar about arduino we had to invent a happy hack featuring arduino. We decided on making a device that would cut power from charging devices using some code for arduino. The Powerbuddy! This prototype doesnt actually charge devices as the arduino doesnt supply enough power, but might be very useful for someone capable with transistors to complete.
In this instructable you'll learn how to make this prototype that will connect and disconnect charging devices.
You will also learn how to setup a user interface for the timer using an OLED mini display!
WARNING: the device did not work for us. This is because we couldnt get our transistor to function like an electronic switch, but you might be able to get it to work.
Step 1: Step 1: Materials
For this instructable you’ll need:
-1pc arduino UNO programmable chip
-1pc 0.96 inch OLED 128x64 I2C-20pcs arduino wire (10 F-F/10 M-M)
-1pc 9V battery holder + battery (you can choose to use an AC adapter)
-4pcs Mini Push Button Switch
-7pcs resistor 221 Ohm
-1pc RGB LED 5MM
-roll of cork-sticker (for making snuggly fits)
Step 2: Step 2: Breadboard Wiring Test
See picture for the wiring you'll need to do.
description of pin functions:
PIN2: apply button
PIN3: move-digit button
PIN4: add-digit button
PIN7: USB GND switch
PIN-A1: Green light
PIN-A2: Blue light
PIN-A4: SCL-screen data
PIN-A5: SDA-screen data
Step 3: Step 3: Programming the Arduino
The code exists of a few custom functions written for efficiency and convenience.
The OLED display is programmed in a way so it has two states: The Timer Select stage, and the Charge state.
The four button inputs are arranged into a simple layout: [UP] - [NEXT] - [RESET] - [APPLY]
In the Timer Select stage you can use the [UP] button to increment the selected number, like in old alarm clocks. With [NEXT] you cycle through all the individual numbers.
So with these two controls you can set the charge time in hours, minutes and seconds. After this you hit [APPLY] to start the Charge state. During this stage the given time will decrease until it hits zero, and reset into the Time Select stage, whilst putting the digital output signal (pin 7) on LOW so the USB does not get a current.
The libraries used in this sketch are:
- Adafruit_GFX (Core graphics library for the OLED display)
- Adafruit_SSD1306 (Hardware library for this specific OLED display)
- SPI (built-in Arduino) - Wire (built-in Arduino)
NOTE: We have used a custom Font which will need to be imported into the Adafruit_GFX/Fonts folder: Org_01.h
Step 4: Step 4: Testing
Test if your device functions as intended, controlling the timer is similar to setting up an alarm clock:
1 button for adding digits to the currently selected.
1 button to shift to the next digit.
1 button to reset the clock (when the clock is running you’ll have to press it for about a second to prevent accidental pressing)
1 button for starting the clock.
If the buttons and display work as intended, you can continue to the next step, if it doesn’t run through the wiring schematics again.
Step 5: Step 5: Prepping Your Case for Components
Our case dimensions are 138mm*98mm*50mm. Featuring a custom lasercut lid which we'll share in this instructable!
Choose a box or something else which will fit the amount of materials that are needed for the Powerbuddy to work. For the needed materials, look at step 1: Materials.
Use something like small tape or wire to wind the cables together in order to save space later on. Be sure to connect the cables to the Arduino before winding them together. Also test if the arduino is working, when all the pins are connected.
As you can see in the left corner, we used a 9 volt battery as our power supply. Make sure the top of the powerbuddy is cut out well enough to fit the knobs, led and display. If not, use your file tool to enlarge the holes. When they are to big, add a few pieces of cork to the edges between the knob and the top of the Powerbuddy.
Step 6: Step 6: Transfer Wiring
Now transfer the wiring from the breadboard to the casing. make sure to do one component at a time, because it can be an absolute nightmare once the thing gets tangled.
Step 7: Step 7: Testing & Tweaking
Now make sure everything still works as it did before. We had a lot of trouble with bad connections in soldered wires, so be patient. Get yourself a nice cup of tea because this might take a while. once all is in working order, use some more cork to tighten the edges of the lid and continue to the next step.
Step 8: Step 8: Done
Presto! your very own almost-practical-and-working powerbuddy!
We hope this might be useful to someone in any way.