Skip to content

13. Output Devices

1. Weekly Brief Summary

I learned the function of MOSFET, and how to control push-pull type solenoid, measure power cosumption.

2. Weekly Assignment Requirement

Group assignment:

  • Measure the power consumption of an output device
  • Document your work (in a group or individually)

Individual assignment:

  • Add an output device to a microcontroller board you’ve designed and program it to do something

3. Group Assignment

img01

FabLab KAMAKURA 2021 Lab site / Output Devices

4. Prototyping

In my final project, I want to use some solenoids for control flippers and bumpers on pinball game board. Solenoids usually needs high voltage, and it’s first time to use them. I started with Arduino & breadboard prototyping.

img02

I refered to this site, and made same circuit, original diagram below is from same page.

img03

Solenoid needs high voltage/current to move, for example, ZHO-0420S-05A4.5 needs DC5V±5% with 1.1A. Compare to typical LED needs 2.1V with 30mA.

If microchip’s output pin cannnot send 5V/1.1A for solenoid, it needs to be supplied from other power source. However, we have to control solenoid by microchip’s weak signal, then we use transistor/MOSFET(one type of transistor) as amplifier. Transitor have 3 ports, one(Collector/Drain) is connected to power source and devices moved by high voltage/current, another(Base/Gate) receives signal from controller, last one(Emitter/Source) goes to the ground. Only when collector/drain get signal, other ports connect and flow current.

Diode(1N4006) prevent back electromotive force from solenoid and save power supply, in this case Arduino.

img04

int TR = 2;

void setup() { 
pinMode(TR,OUTPUT);
}

void loop() { 
digitalWrite(TR,HIGH);
delay(2000);
digitalWrite(TR,LOW);
delay(2000);
}

In this program, arduino’s digital PORT 2 send HIGH signal for MOSFET every 2 seconds. When MOSFET get HIGH signal, it allow flow current from arduino 5V power supply (MEMO:Arduino UNO’s digital pin can send 5V, but cannot flow 1.1A, 40mA is maximum).

img05

5. Measuring Power Comsumption

We used Regulated power supply and Digital Multi Meter , for measuring power comsumption. In detail, get Current and Voltage values.

Once set Voltage on Regulated power supply and delive power to circuit, you can see current on display. If current will over the maximum, it automatically suppressed to the upper limit.

img50

img51

Digital Multi Meter can see current, resitor, voltage value. However, when using for measure current, we should include its internal resistance in the calculation.

I tested and do math for 3 kinds of solenoids.

img51

6. Design & Make Board

I designed ATtiny3216 version of solenoid control board by EAGLE.

Component Quantity
ATtiny3216 1
1uF Capacitor 1
Diode 1
Solenoid / ZHO-0420S-05 A4.5 1
MOS-FET / MOSFET 2SK4017(Q) 1
10kΩ Resistor(pulldown) 1
Chip LED 3
511Ω Resistor 3

img06

img07

img08

img09

hello echo program did work and LED can be controlled. It shows FTDI/UPDI connection worked well. However I didn’t control solenoid from this board at first time. With watching and compare to prototype on breadboard I tested carefully, using digital multi meter for checking connection on circuit, finally I found the connection between pin and copper board doesn’t work, and didn’t supply enough power for solenoid. So I detached and re-soldered some pins and parts, then it works !

img10

img11

img12

int SOLE = 0; // PA4
int LEDA = 1; // PA5
int LEDB = 2; // PA6
int LEDC = 3; // PA7
int SPKR =  4; // PB5

void setup() {
  Serial.begin(115200);
  pinMode(SOLE, OUTPUT);
  pinMode(LEDA, OUTPUT);
  pinMode(LEDB, OUTPUT);
  pinMode(LEDC, OUTPUT);
  pinMode(SPKR, OUTPUT);
}

void loop() {
  digitalWrite(LEDA, HIGH);
  digitalWrite(LEDB, HIGH);
  digitalWrite(LEDC, HIGH);
  digitalWrite(SOLE, HIGH);
  delay(1000);


  digitalWrite(LEDA, LOW);
  digitalWrite(LEDB, LOW);
  digitalWrite(LEDC, LOW);
  digitalWrite(SOLE, LOW);
  delay(1000);
}

7. Learning Outcome

  • I learned the function of transistor/MOSFET.
  • Output devices need fluent power supply, and they can be measured by tools, stable power supply and digital multi meter.
  • I’ve managed to get the solenoid working, but I feel it is so weak to move or push metal ball. I need to find more suitable ones.

Last update: June 20, 2021