VendArt at MakerFX

 

 

 

This effort aims to restore a National Vendors, Inc. Manual Cigarette Merchandiser Series 222, which was a classic mechanical cigarette vending machine that was popular between the 1960s and 1980s.  The machine that I’m helping restore is from 1975. 

I’m responsible for restoring the mechanical vending mechanisms, integrating a solution that accepts modern payment methods while preserving the machine’s original/existing hardware.  When restored, this vending machine will sell local makers’ unique makes at various Central Florida maker events, like Maker Faire Orlando. 

The machine’s vending mechanisms are locked when idle, preventing the pull knobs from dispensing items from their respective magazines.  When payment is accepted, a solenoid engages the vending mechanisms to unlock the pull knobs and enable vending.  I was tasked with replacing the missing solenoid, designing and implementing a solenoid driver, and writing the code that drives the solenoid during a transaction.

 

 

 

Tech Stack

Mechanical

Electronics

Software

Development Environment

Fusion 360

Raspberry Pi Pico W

Python 3.13.9

Visual Studio (VS) Code

Bambu Lab P1S 3D Printer

MP1584EN DC-DC Buck Converter

Bambu Studio

Thonny

Solenoid 12V 10mm 5N Push Pull

IRLZ44NPBF Logic Level MOSFET

GitHub

Prototyping

Breadboard

 

 

 

Soldering

 

 

 

 

Mechanical

 

Left and Middle: Internal Vending Unit

Right: Vending lock mechanism detail

 

 

Solenoid 12V 10mm 5A Push Pull

 

Technical Specifications

Voltage

12VDC

Current

1.7A

Force

5N

Stroke

10mm

 

 

Retrofit Solenoid XYZ Adjustable Mounting Carriage

Newly designed solenoid XYZ mount retrofitted onto the original mounting bracket

 

 

Electronics

Raspberry Pi Pico W

 

 

MP1584EN DC-DC Buck Converter (Step-Down Converter)

 

·       I wanted the solenoid and microcontroller to share one 12VDC power source, but both components have different electrical requirements:

o   Solenoid: 12VDC, 1.7A

o   Raspberry Pi Pico W: 5V, 95mA

·       A buck converter, AKA step-down converter, efficiently reduces a higher input DC voltage to a lower output DC voltage

o   This protects the lower-voltage components that are connected to a higher DC source voltage

·       An inductor stores and releases electromagnetic field and smooths the current by resisting rapid changes

·       A switch creates a duty cycle that outputs a desired voltage lower than the source

o   The lower the duty cycle, the lower the store in the inductor

o   Think Pulse Width Modulation (PWM)

o   The switch is usually a transistor (MOSFET)

·       A diode creates a path for the current when the switch is turned off

·       A capacitor smooths the voltage rippled

·       The buck converter unit uses a control (potentiometer) to control the output voltage

 

 

IRLZ44NPBF Logic Level MOSFET

 

The image shows two small electronic components, each with a label indicating a different model number, suggesting they could be integrated circuits or transistors.

AI-generated content may be incorrect.

IRLZ44N

 

·       A MOSFET is an electronic switch that controls current flowing through a semiconductor channel using an electric field

o   MOSFET Terminals

§  Gate (G): Control Input

§  Drain (D): Where current flows out

§  Source (S): Where current flows in

 

What is Mosfet? What does it do? P-Channel & N-Channel – RC Models, DIY  Hobby Elektronics, Arduino projects, RC Airplanes

o   N-Channel:

§  Turns on when the gate is more positive than the source

§  Current flows from drain to source

§  Efficient and low heat

§  Motor drivers, solenoids, power supplies, high-current applications

 

o   P-Channel

§  Turns on when the gate is more negative than the source

§  Current flows from source to drain

§  Simpler but less efficient at high currents (higher )

§  Battery-powered devices

 

·       The IRLZ44N is a logic-level N-channel MOSFET, which allows us to engage and disengage the solenoid by passing a boolean to the MOSFET gate with the solenoid driver code

·       2 main parameters for selecting the appropriate MOSFET: Voltage (V) and Current (I)

 

 

·       Start with the MOSFET spec sheet:

o   Spec sheet assumes proper cooling, so operating the MOSFET at the rated specs without proper cooling (fans, heat sinks, etc.) can overheat or melt the unit

o   The Current spec only says that the MOSFET will not melt when operating at 47A when properly cooled

§  While the Current and Voltage are used to determine how a system will operate, the MOSFET’s internal resistance, , sets the threshold

·        tells how much power needs to dissipate from the MOSFET at a constant load

o   Constant Load: >10 seconds without a heat sink

The image shows a detailed datasheet for a logic-level gate drive IC, featuring specifications for maximum ratings, thermal resistance, and electrical parameters.

AI-generated content may be incorrect.

MOSFET IRLZ44N Spec Sheet

·       Thermal Power Generated:

o   Recall – the internal resistance, , is the spec that we will use to threshold our MOSFET selection calculations

o   Since there isn’t perfect control of the load on the MOSFET, we degrade the  by 20-30%

§       Increase  by 20%: 

 

o   Now calculate the thermal power generated, , by the system given the load’s specs

§  Since we are using the MOSFET to drive the solenoid, we are using the solenoid specs defined above as the load

 

 

·       Thermal Power Lost:

o   These thermal losses need to somehow escape the MOSFET, and that can be determined with the thermal resistance,

§  This tells you how much the MOSFET will heat up for each watt of thermal loss,

 

o      Now that we’ve solved for , we can calculate the thermal losses to confirm that they are within the MOSFET’s specifications

§  The MOSFET spec sheet indicates that the Thermal Resistance, , for a MOSFET without a heatsink (Junction-to-Ambient) is

·       Use the heatsink spec sheet if a heatsink is screwed onto your MOSFET

·       We assume that ambient is  when unknown or unspecified

§  We calculate the thermal loss by multiplying the thermal power generated, , and the thermal resistance,

 

o   The calculated thermal loss can be compared to the Operating Junction  and Storage  Temperature Range indicated on the spec sheet:

 

o   Since the calculated temperature from thermal losses falls within this spec, we determine that the MOSFET can safely operate under the solenoid’s load

 

 

·       MOSFET Drive Levels

The image appears to be a datasheet or technical specification sheet for an electronic component, detailing various electrical characteristics such as breakdown voltages, resistance, capacitance, leakage currents, and transconductance at a temperature of 25ᅡᄚC.

AI-generated content may be incorrect.

 

o   Since this MOSFET is a logic-level MOSFET, we need the voltage from the logic signal that the microcontroller produces

§  The solenoid will be driven by the Raspberry Pi Pico W microcontroller, which outputs 3.3V

o   The MOSFET spec to track here is the Static Drain-to-Source On-Resistance,

o   Notice that the resistance values on this spec are more in line with the resistance we calculated losses with at the 20% margin

§  Resistance goes up as the voltage goes down, which is the relationship indicated by

 

·       Confirm MOSFET selection

o   The spec sheet doesn’t indicate Static Drain-to-Source On-Resistance, , but I still want to confirm that my system won’t exceed the MOSFET’s thermal constraints

o      I’m using the indicated  for 5V and 4V to linearly extrapolate  for the microcontroller’s 3.3V

 

 

o      Now that  is calculated for my system, I can revisit the calculations and use my estimated  to more accurately determine the thermal effects on the MOSFET

 

 

 

o     At , I’m still well within the Operating Junction  and Storage  Temperature Range indicated on the spec sheet, so my solenoid driver will not thermally compromise the MOSFET

o   This MOSFET is excessive for my solenoid driver’s electrical parameters, but its large voltage and current margin will be reliable and usable

 

 

Solenoid Driver Wiring Schematic, designed in TinkerCAD Electrical

 

 

Solenoid Driver Breadboard

 

 

Soldered Perfboards

Left to Right: Solenoid, Solenoid Driver, Buck Converter, Raspberry Pi Pico Microcontroller, Demo Buttons

 

 

Solenoid Driver/Buck Converter Stack

Assembled solenoid driver unit on soldered perfboard

 

 

Software

·       All code implemented in this solenoid driver is publicly available on my github!

o   Solenoid Driver

 

 

Helpful Links

·       MOSFET Explained - How MOSFET Works

·       MOSFET Selection Calculations

·       How to Use N-channel MOSFETs as Switches