Final Project¶
Summary¶
My asset files are here.
Pill Dispenser Introduction¶
I would like to make a pill dispenser that would help my nephew take his medication for the day. Then send him a reminder before letting my sister in law know if my nephew has taken his medication for the day.
Breaking it down into sections: - pill dispenser body - pill cartridge - sensor or camera in dispensor area - app to notify - electronics to make it work
I worked with my daughter, Sage Kanofsky, to make sketchs of a pill dispenser. She is in Industial Design school at Georgia Institute of Technology. She is currently studying abroad the Polytechnic University of Valencia.

Past Pill Dispensers at Fab¶
[Griffin van Horne - Fab Academy 2021] (https://fabacademy.org/2021/labs/dassault/students/griffin-vanhorne/projects/final-project/) made a small handheld version with bluetooth.
Corey M. Rice : Fab Academy 2017 made one that distributes the right amount of a whole bottle of pills.
Lily Yeazell at MIT made the cutest pill box!!
Loes Fab 2021 made a box with alarms.
Miriam Choi showed this instructables project in her presentation. It is very similar in many ways to what I was thinking. They are using an arduino and an LCD. I am using an ESP32 and an app. My design is original and my version is upgraded with the purpose of caretaker notifications and interchangeable cartridges.
3D models¶
Then later I worked in Fusion 360 to make a 3D model

We've been discussing this dispenser and a few other items in what we call the "remember me" line. This would be helpful not only to Mika, but also to me and my family as I age. My father had alzhiemers and as he aged, t he more things that he had to help with memory, the more independent he could remain. I would like to create things that make the burden on family less, and increase the feeling of independence for all who struggle with memory for one reason or another.
I have seen that other pill dispensers have been done as fab projects. I hope that mine will be different in a couple of ways:
-
Cartidges that can be preloaded
-
Messages sent first to the pill taker, and second to the car giver
Timeline¶

Then I also met with DR. Taylor who helped me related each part of my project even better to the weeks we will have in Fab.

3D Printing¶
During the modeling week, I worked on my body parts and cannister. The body I printed was too small for the motors that we are using at the lab. I could ordeer a smaller motor, but I want to stick with what we know for now and get everything working, so I will change the model a bit to fit the NEMA 17.

I made many notches and other additions to the CAD model to make the mechanics of the dispenser easier. Example: the stop for the acrylic piece at the top so that it doesn't spin past the edges when its closed.

notch from teh body to the bottom body.

Notch for the catridge to seat on the top body

During the modeling week, I worked on my body parts and cannister. The body I printed was too small for the motors that I had. I asked for a NEMA 8 which is smaller and still has enough torque for my application.
My first print of the cartride outer body, i had a few errors. I had combined the outer rim and the bottom to one stl to print, but didn't notice that i had made the bottom a slight be smaller in case i wanted it to spin in the original desdign. I also needed to cut the center in a cirlce so the key can spin freely inside the cartdidge and only turns the pill divider to push the pills.

When printing the divider, the edges were coming up on my prusa MK3s. classmate Angela Horstman suggested that I add more of a brim to help it adhere better.
I
I printed a new pill cartidge all as one piece with a cut out in the middle for the "key" to spin.
The tree supports on the latest body print are so cool. I had to take a pic.

Computer Controlled Cutting¶
I used the laser cutter to make the top pf the cartridge lid that will swing open.
I cut my lid on the laser at the lab. Our laser with the picture line up was being repaired, so I used the older laser that you manually align. I brought my lid file in corel draw on the laser computer from an SVG off the fusion file. I used the epilog settings for Acrylic.

When it ran on the laser, Collin Kanofsky pointed out that the laser was running twice in certain areas but not others. So I needed to modify the corel file to remove the overlapping lines.

It wasn't cutting through so we needed to run it multiple times. When trying to adjust our cut path, I moved the part in the file and then it cut through the wrong part.

I separated the two and then deleted the extra and then ran it again over 3 inches to a clean spot. I had to run the cut multiple times to cut through. Possible dirty lense?

Electronics Design¶
I started working on the stepper motor and the electronics design with a tutorial. I used first the RP 2040 and then did it again with the ESP32C6. In the end, I went with the XIAO ESP32C6 to move forward with my project.
I used a breadboard to start laying it out to see if it would work.

During our electronics design week, I designed a board that I could use in the final project. I may need to make it smaller or change the shape if I want it to fit into my project. or it can be on the side since it fits the theme.

Computer Controlled Machining¶
I'd like to make my base for my pill dispenser from wood for aesthetics.
I did some preliminary work in easel, but ran out of time during the CCM week, hopefully I will get back to it.


Electronics Production¶
During our electronics design week, we learned to mill boards. My final board had a smaller shape than the original cool brain to fit into the machine, but a similar component layout.
I'm using the board that I milled in week10 but didn't finish that week.
Soldering¶
Classmate Dorian Fritze sent me a link to these medical grabbers that lock. They were a COMPLETE game changer for soldering.
I laid out my components and got to work.

Drilling¶
I manually attached the power connector. I used a trick from Collin Kanofsky by putting the phone as a flashlight to locate my traces and mark out where I wanted to drill.

Then I put the board in a vice and drilled with the smallest bit I had, which was unfortunately a 1/16th - still pretty big. but worked.

Testing Lots of Testing¶
I used the multimeter in continuity mode to test test and test some more.. every connection, and every gpio to each other. I found that I had some solder bridging and had to go back in and clean it up so there would not be connections where I didn't want them.


NEMA 8 Stepper Motor¶
Following the same tutorial that Mr. Dubick sent, I tried the twist test on the four wires that connect the stepper motor to figure out which two wires of my NEMA8 are a pair.

When the twist was clicky, those were a pair compaired to smooth when you turn the motor shaft. This wasn't convincing for me so I to find the phases using the multimeter. Continuity testing will determine theo ne phase of the motor that goes on 1A and 1B pins, and the other phase on 2A and 2B pins.

A4988 Motor Driver Current Limiting¶
I need to adjust the current limit of the driver to be lower than the current rating of the motor, so that the motor will NOT overheat.
I hooked everything up. It took me a really long time because I was really worried about the 12V current and making sure that I didn't mess anything up (i.e. burn up the chip especially after how long it took me to mill the board and solder everything on).
I found the tiny sense resistors on the 4988 and they were 100mOhm (I would use .1 in my calculations). They connect to the motor coils.
I then measured the Vref reading by measuring over the potentiomer to the ground with a multimeter set to Voltage reading. The below picture from the tutorial was really helpful.

I turned the potentiomer to be less than my calculated Vref for a 0.6 max Amp motor. This meant that it should read ~0.39 for my project.

Photoresistor¶
To incorporate the photo resistor, I had to put heat shrink around one leg so they didnt touch in the tunnel. Then on the ends, I used an extension to connect to the board. One one end of the extension, I used the shrink wrap tube with solder into it to extend it.

I decided to try traditional soldering for the other end becuase I worried about the heat gun melting my 3D printed part.
Two Buck Chuck¶
I have two power sources coming from device. One from the chip and another powering the motor. I did some research and it sonds like I need a to use a small DC-DC buck converter to step it down to 5V for the XIAO. So I will split the currnt coming using another little chip that I will mill and then have a buck on it and two outputs.. a 12V (power to the motor) and a 5V (power to the chip).
Embedded programming¶
I started with the codes I had made in the weeks coming up to combine together to make the code. I have the following code pieces:
- code that turns on and off light a light from a browser on my phone
- code that reads the light value from my photo resistor and then takes an action
- code that spins a stepper motor 1/8 a turn
I used a series of prompts and then took pieces from each to keep modifying my initial code working towards a final code.
Motor Programming¶
I have started working on programming a motor to move in steps. I need 8 steps per revolution to match my design. I found some documentation to help me with the arduino stepper library. For the example motor I have from my ELEGOO kit.. its 2048/8. I have another motor that i want to try that I got from the lab. More research is needed.
I started learning using the stepper.h library but the A4982 doesn't work that way. It only wants a STEP pulse and a DIR signal. So my code uses delayMicroseconds(1000) to set up step pulse timing. I found that 20,000 had it spinning too fast and at 8,000 it was missing steps. I ended with delays 15,000 and that worked well. It's a bit jerky. The fix for that is microstepping, but that will be in V2 becuase I grounded my microsteppers on the PCB under my chip. The stepping will work accurately enough for what I need in V1.
PROMPT: my motor is warm - not hot hot , but warm. is that ok?
CLAUDE: Yes, warm is totally normal for a stepper motor — actually expected. Steppers are always energized even when standing still, so they generate heat continuously. Your NEMA 8 is a small motor so it'll warm up faster than a bigger one.
The rule of thumb: if you can hold your hand on it comfortably, you're fine. If it's too hot to touch, that's when to worry.
A few things that affect how warm it runs:
- Current limit (Vref) — if your Vref is set higher than needed, the motor runs hotter. Worth checking that your Vref is dialed in for 0.6A
- Holding torque — when the motor is just sitting there energized between moves it still draws current. You can add a disable-when-idle feature later if heat becomes a concern:
// after a move, disable the driver
digitalWrite(ENABLE_PIN, HIGH); // HIGH = disabled on most drivers
// re-enable before next move
digitalWrite(ENABLE_PIN, LOW);
My Vref is way below my calculation. So, I incorporated that code to disable the motor, and moved on.
Another issue with the code was that my initial print line asking how many slots I wanted to turn was not coming up..
PROMPT: the initial print line is not coming up from void set up
CLAUDE: Try adding a longer delay
I did that and it worked
MIDTERM REVIEW REQUIREMENTS¶
On your final project site post - a system diagram for your project, list the tasks to be completed, - make a schedule for doing them, - meet with your local and global instructors to review these and your weekly assignments. (scheduled for 4/20/2026)
System Diagram ¶
Diagram
Claude Co work Assisted PROMPT: help me make A map of my pill dispenser project and all of the components - maybe in power point of google slides so i can edit it



List of things to be completed ¶
- Reprint 3D cartridge body, divider and stepper motor key
- test function and tune settings
- implement power splitter - buck?
- System integration
- Create code
- Create interface
- make slide
- make video
My Claude assisted Time Line is Here
PROMPT: make a gaant style time line for getting these things done by the end of May
Application Creation¶
I did most of my application work in week 15
System Integration¶
As I went to integrate my system, my board was coming apart, so I went back and worked on redesigning a more compact board and addedthe ability to connect a light to be able to dispense at all times.
Voltage¶
When I started, I was told to use a 12V power sourse. This is most likely becuase the A4988 motor driver data sheets specs out 8V-25V.
At open time, I got a lot of push back on why was I using the 12V, and I wasn't fast enough in the memory department to answer. They said 5V is more than enough.
PROMPT: many teachers said that 5V is plenty - can you recheck that information and make sure taht we rae supposed to have 8V. Low torque was a problem at one point, but I raised the Vref and its working now. I want to be able to explain what the A4988 asks for and make sure i have enough torque
CLAUDEs Explanation:
Good — the datasheet spec is confirmed as 8V minimum, and your teachers are somewhat right in practice. Here's the full honest picture:
What the datasheet actually says VMOT: 8V – 35V is the official spec from Pololu (who make the most common A4988 carrier board). So 8V minimum is real, not made up.
Why your teachers say 5V works Technically yes — minimum VMOT is 8V per spec — but performance will be poor. The A4988 regulates current by rapidly switching (chopper drive), and a low voltage supply limits this ability.
This is the key insight: the A4988 is a chopper driver, meaning it rapidly switches current on/off to maintain your set current limit (Vref). At higher voltages, it can ramp current up faster after each step — giving you more torque at speed. At 5V, it still works, but the current ramps more slowly, which hurts torque especially at higher step rates.
Why raising Vref fixed your torque problem
When you raised Vref, you increased the current limit, which directly increases holding and dynamic torque. That's the correct fix. The relationship is:
Vref = Imax × 8 × Rsense
For a 0.1Ω sense resistor, 1.0V Vref yields 1.25A per phase. So torque is primarily a function of current, not voltage — voltage just affects how quickly you can reach that current per step.
Bottom line for your pill dispenser
Your NEMA-8 at low speeds (dispensing pills, not spinning fast) means the slower current ramp at 5V barely matters — you're not doing high-speed stepping. So 5V VMOT is fine for your use case, Vref is your real torque lever, and you've already proven it works. The 8V spec is more relevant for applications needing torque at high RPM.
So I will stick with the 5V for now.. and I am thinking about adding a regulator to my board.Everything cooled down., but the wifi seemed to have a hard time powering up. I am wondering if the power supply is a part of this. Claude thinks its electrical noise.
I wanted to understand more about how the Voltage impacts the machine.
PROMPT: would it be better to use a 9V 2A sources? how does the Voltage impact the machine
Good question — here's the tradeoff:
9V 2A vs 12V 2A Power Source
| 9V 2A | 12V 2A | |
|---|---|---|
| Works with A4988? | ✅ Yes (min is 8V) | ✅ Yes |
| Motor torque at speed | Good | Better |
| A4988 heat | Less | More |
| Buck converter heat | Less | More |
| Power headroom | Tight-ish | Comfortable |
| Availability/cost | Common | Very common |
How Voltage Impacts Your Specific Setup
Motor performance: Higher voltage means current ramps up through the coils faster between steps. At slow step rates (which sounds like your use case for a pill dispenser) this difference is barely noticeable. It matters more at high speeds.
Heat: 9V would run your A4988 and buck converter noticeably cooler since there's less voltage to dissipate.
Headroom: 9V 2A gives you 18W total. Your worst case load is ~1.15A, so at 9V that's about 10W — plenty of margin.
Bottom Line
For your pill dispenser running at slow speeds, 9V 2A is actually the smarter choice: - Cooler running - Still well within A4988 spec - No meaningful performance difference at low step rates - Same cost or cheaper than 12V
The only reason to prefer 12V would be if you needed high speed stepping, which you don't.
Based on this, I ordered a 9V 2A power supply. Everytime I put on the 12V, things seemed to heat up too much.
LEARNING NOTE (cluade assisted): Exactly right — you've got it. Voltage doesn't add up across components, you just need to satisfy the hungriest requirement.
Voltage Requirements
| Component | Minimum Voltage |
|---|---|
| A4988 VMOT | 8V |
| ESP32-C6 | 3.3V (or 5V input) |
| A4988 logic | 3.3–5V |
| LED + photoresistor | 3.3–5V |
The A4988 VMOT at 8V minimum is the limiting factor — everything else is happy at much lower voltages. So your supply just needs to be above 8V, and then you step the voltage down with the buck converter for everything else.
Voltage vs Current follow different rules:
- Voltage → pick the highest minimum requirement among your components
- Current → add up all the requirements (which is what we did in the table)
The decision process is:
Voltage = max(all minimum voltages) + some headroom = 8V min → choose 9V or 12V
Current = sum(all component currents) + 25% headroom = ~1.15A → choose 2A
Amperage¶
I wanted to understand the Amperage needs of my system and how it was calculated.
Current Calculation at 12V¶
| Component | Current |
|---|---|
| Stepper motor (full step, max) | 600mA |
| A4988 logic (VDD from buck) | ~20mA |
| ESP32-C6 (WiFi active, peak) | ~500mA |
| White LED (assume 20mA) | ~20mA |
| Photoresistor | ~1mA |
| Buck converter overhead (~85% eff.) | ~15mA |
| Total worst case | ~1,156mA |
So I need a 1.5 to 2 Amp source.
Testing¶
Light Sensor Tuning¶
Using the IP address an the/lightstatus in my browser, I was able to take multiple readings in different light conditions with different pills.
| Light/Pill Status | ADC Value | Threshold setting | Pill taken? |
|---|---|---|---|
| Dim Light | Raw ADC: 2400 | Threshold: 2000 | Pill taken: NO |
| Dim Light + B-12 | Raw ADC: 3317 | Threshold: 2000 | Pill taken: NO |
| Dim Light + Lysine | Raw ADC: 3299 | Threshold: 2000 | Pill taken: NO |
| Dim Light + Zyrtec | Raw ADC: 3206 | Threshold: 2000 | Pill taken: NO |
| Bright Light | Raw ADC: 946 | Threshold: 2000 | Pill taken: YES |
| Bright Light + Zyrtec | Raw ADC: 2919 | Threshold: 2000 | Pill taken: NO |
| Bright Light + Zyrtec2 | Raw ADC: 2943 | Threshold: 2000 | Pill taken: NO |
| Bright Light + Lysine | Raw ADC: 2739 | Threshold: 2000 | Pill taken: NO |
| Bright Light + B-12 | Raw ADC: 3256 | Threshold: 2000 | Pill taken: NO |
2000 Threshold is too low. Maybe closer to 2600… would be more reasonable.