we did it. we made it to the end. here is my final rotating pill lamp that I am incredibly excited to share with you all 🙂
here is “A Tough Pill to Swallow” … I really liked this name at first but wasn’t sure if it was too serious so for the sake of the product title on Instructables it is “Rotating Pill Lamp”

This project is a large pill-shaped lamp that reminds users to take their medicine. When the pill lamp is rotated 180 degrees the lamp turns off and then when rotated again it will turn back on. This links the action of turning off the lamp before going to sleep with taking one’s pills before bed. This lamp is a great way to remember to take your medicine while also adding a unique light to any room!
Step 0: Sketch it Out!

Step 1: Parts, Tools, and Materials
- eSun PLA Filament 1.75mm
- Tilt ball switch
- Arduino Nano ESP32 Board
- 2 NeoPixel Stick
- A power cable
- 3D printer
- Wiring
- Solder
- Soldering tools
- Solder-able Breadboard
- Tracing Paper
- Elmers Glue & Water
- Plastic Bowl
- Masking Tape
- Petroleum Jelly
- Paper Towels
- X-Acto Knife
- Hot Glue Gun
- Modge Podge Acrylic Sealer Spray (optional)
Step 2: 3D Modeling



Step 3: Paper Mache


Step 4: Circuit Diagram and Code

#include <Adafruit_NeoPixel.h>
// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1:
#define LED_PIN 5
#define SENSOR_PIN 3
// How many NeoPixels are attached to the Arduino?
#define LED_COUNT 12
// Variables will change:
int buttonPushCounter = 0; // counter for the number of button presses
int buttonState = 1; // current state of the button
int lastButtonState = 0; // previous state of the button
// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
// Argument 1 = Number of pixels in NeoPixel strip
// Argument 2 = Arduino pin number (most are valid)
// Argument 3 = Pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
void setup()
{
pinMode(SENSOR_PIN, INPUT_PULLUP);
//pinMode(LED_BUILTIN, OUTPUT);
strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show(); // Turn OFF all pixels ASAP
strip.setBrightness(175); // Set BRIGHTNESS to about 1/5 (max = 255)
Serial.begin(9600);
}
void loop()
{
// read the state of the pushbutton value
buttonState = digitalRead(SENSOR_PIN);
// compare the buttonState to its previous state
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == LOW) {
// if the current state is LOW then the button went from off to on:
buttonPushCounter++;
Serial.println("on");
Serial.print("number of button pushes: ");
Serial.println(buttonPushCounter);
colorAll(strip.Color( 255, 25, 25));
delay(2000);
} else {
// if the current state is LOW then the button went from on to off:
Serial.println("off");
colorAll(strip.Color( 0, 0, 0));
delay(2000);
}
// Delay a little bit to avoid bouncing
delay(50);
}
// save the current state as the last state, for next time through the loop
lastButtonState = buttonState;
}
// Fill strip pixels one after another with a color. Strip is NOT cleared
// first; anything there will be covered pixel by pixel. Pass in color
// (as a single 'packed' 32-bit value, which you can get by calling
// strip.Color(red, green, blue) as shown in the loop() function above),
// and a delay time (in milliseconds) between pixels.
void colorWipe(uint32_t color, int wait) {
for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
delay(wait); // Pause for a moment
}
}
// Fill strip with a color without animating. Pass in color
// (as a single 'packed' 32-bit value, which you can get by calling
// strip.Color(red, green, blue) as shown in the loop() function above).
void colorAll(uint32_t color) {
for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
}
strip.show(); // Update strip to match
}
Step 5: Circuit Construction



Step 6: Assemble and Enjoy!


I chose to go with a bright pink for my pill lamp but the beauty of this lamp is that it is customizable and can be changed at any time by editing the code. This lamp creation is still an ongoing process so I would love any feedback for those reading. My goal is to add strong magnets in the top and bottom of the pill and the base as it is a little top-heavy, but please let me know if there is anything else you would add! Thank you!
Instructables: https://www.instructables.com/Rotating-Pill-Lamp
I learned a lot from this experience. I think the top 3 were first that things always go wrong. You have to have the patience and the time because you will make mistakes and need to pivot and do something different. second is that you can’t be a perfectionist when making a prototype it will never be exactly what you see in your head. third is that I need to be proud of the work that I do and the effort I put into it. I am still trying on that one.
Thanks 🙂














































