Designing & Building the Module Body

Daniel Harmsworth

< >

What I Did

During FabAcademy I have developed a framework for an open-source, modular dispensing system. I have constructed a single prototype dispenser capable of dispensing AA batteries as a proof of concept for more complex dispensing units.

I have also writted controller code for a Raspberry Pi SBC to act as the coordinator for a bank of dispensers, the coordinator is controlled using a REST based API which in turn controls the dispensers using TWI.

What AMPD Does

AMPD Provides a framework for a flexible, modular and free-as-in-freedom dispensing / vending machine, rather than require products to be packaged in large boxes or bags customised dispensers can be developed to suit either industry standard packaging or something more locally available.

What Worked?

Dispensing Batteries

The prototype dispenser developed during FabAcademy performs well, it is capable of dispensing up to 2 batteries per second using a standard, inexpensive servo motor and did not jam or fault at all during the final bout of testing (after a couple of debugging sessions and minor redesigns, see the section on the hopper V1 vs V2).

TWI Communications

I did manage to get the modules (both the ATMega and ATTiny versions) communicating with the Raspberry Pi using TWI, the beauty of TWI in this case is that the different logic levels (5v AVRs and 3.3v ARM) were unimportant when using the Pi as the master, the 3.3v signal was still sufficiently high for the AVRs to see it as a logical 'on' and the Pi takes care of the pullups to its logic voltage.

The current state of the code for the ATMega based dispensers allows for querying the status of the module, querying the product ID of the module and triggering the dispensing of products via the TWI bus.

Module Autodiscovery

One feature that I did get to implement that was originally on my 'would be nice' list was autodiscovery of modules, the current state of the AMPD server software does include a call that will poll an address range and register the product IDs of any dispensers found. I wound up implementing this feature early as it was very useful for debugging of the TWI communications code on the AVRs.

What Didn't?

ATTiny Module Controller

I ran out of time to fully implement and debug the ATTiny version of the module control board, I had started with and ATMega to make use of the dedicated TWI controller to achieve a functional prototype faster, when it came time to port to the ATTiny to try and reduce part costs and improve ease of manufacture I encountered an issue with the servo pulse timing.

Servo Control on the ATTiny

I ran into difficulty getting the servo pulses to generate correctly on the ATTiny44 version of my module controller, I have not had time to completely investigate the issue but a decription of what has happened is fully documented on the electronics & software page.

What I Learned

Process Selection

After several false starts using the processes more familiar to me (like 3D printing and lasercutting) I feel like I have gotten a much better handle on selecting appropriate digital fabrication processes.

Project Management

I think the key lesson here for me has been to really work at building a minimal proof of concept before launching into building a complex system. My original project involved the construction of a module that could dispense SMD tape including cutting it to length, whilst this on its own is not monstrously complex when coupled with the need to develop the software, communications and electronics it quickly became unrealistic for the timeframe, I switched to a simple dispenser to prove that the concept was functional and (with the aid of caffeine) achieved what I wanted.

Design Files


Mechanical Components
Part Part Number Quantity Supplier
Servo Mounting Bolts M4x10 4 Searle Fasteners
Rotor Bearings 608ZZ 2 VXB Bearings
Servo Motor HS-311 (HiTec Servos) 1 HobbyTech
Electronics Components
10μF Capacitor 587-1352-1-ND 1 Digikey
ATTiny44 μController ATTINY44A-SSU-ND 1 Digikey
2 Row SMD Pin Header P5415 1/6 Altronics
10KΩ 1206 Resistor 311-10.0KFRCT-ND 1 Digikey
49.9Ω 1206 Resistor 311-49.9FRCT-ND 2 Digikey
Red LED (1206) 160-1167-1-ND 1 Digikey
Green LED (1206) 160-1169-1-ND 1 Digikey
Manufactured Components
Part Process Quantity Manufacturing Files
Dispensing Rotor 4-Axis CNC Milling 1 IGES
Non-Driving Pillow Block FFF 3D Printing 1 STL
Motor Mount Block FFF 3D Printing 1 STL
Servo Drive Coupler FFF 3D Printing 1 STL
Front / Back Hopper Wall Lasercutting (3mm PMMA) 2 DXF
Side Hopper Wall Lasercutting (3mm PMMA) 2 DXF
Module Controller PCB PCB Milling 1 Traces: PNG
Cutout: PNG