First up, let’s wire up our contraption! Take your Raspberry Pi and connect up the keyboard and HDMI display.
Now we need to take the lantern apart to reveal its power wires. As you can see, after removing the 4 screws on the battery-holding base, we gain access to the RED (5v) and BLUE (GND) wires. To turn the lantern on or off, all we need to do is send 5v down these wires!
We will be using a transistor send this voltage and turn the lantern on and off. Why not just connect the input of the lamp straight to the RPi, you ask? Well, this is because the RPi’s control pins (also called “GPIOs”) are unable to output the power we will need to illuminate the lantern. The transistor works in a similar way to a relay, like an electronic switch which passes current through it when a voltage is applied.
Each Friday is PiDay here at Adafruit! Be sure to check out our posts, tutorials and new Raspberry Pi related products. Adafruit has the largest and best selection of Raspberry Pi accessories and all the code & tutorials to get you up and running in no time!
Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!
Python for Microcontrollers – Adafruit Daily — Python on Microcontrollers Newsletter: A New Arduino MicroPython Package Manager, How-Tos and Much More! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi
EYE on NPI – Adafruit Daily — EYE on NPI Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey