Goals:
A problem I have in my everyday life is dealing with the inconvenience of my laundry situation; I live on the third floor and the washer and dryer are in the basement. I often find myself making multiple trips up and down the stairs only to find the laundry isn’t done, or I’ve forgotten to grab quarters. My aim with this project was to address both of these issues.
Solution:
This project gives me a way to both store and keep track of how many quarters I have, and to monitor how long there is left in the laundry cycle. The device can display your current balance in quarters, has an illuminated progress bar to indicate how much time is left on the laundry, and LEDs to show whether you’re timing washing or drying, and to notify you when the timer is done. A sliding switch toggles between washing and drying modes, a button dispenses coins one at a time, and a pair of buttons sets and resets the timer.
Materials:
- Arduino Uno
- Laser cut wood housing
- 3x 8-way MUX
- 4-digit 7-segment display
- 10-bar LED bank
- 3x LED
- 3x push button
- Bump switch
- Sliding Potentiometer
- 4x 6.4v Zener diodes
- 5x 330 ohm resistors
- 4x 10k ohm resistors
- Servo motor
Challenges:
I faced many challenges in the design and building of this device. The primary challenges being driving 3 7-segment digits, and finding an element way to dispense the coins. The chief barrier that prevented the device from being ready on time though was the electrical complexity that arose from designing the solutions to the aforementioned problems.
The solution to the display problem went through several iterations before arriving at what I think is the best way to do it. First, the idea was to use zener diodes and a lot of muxes to bounce back and forth between all the necessary inputs. Here’s an early schematic of this design:
The obvious problem with this design I found early on was it became very, very complex very fast. The design pictured only had 1/8 of the necessary functionality and was already hugely complex.
A second iteration used fewer muxes, and had worked off of the idea that only certain digits needed to be displayed at certain times and I could bounce back and forth between them quickly in software. But the hardware execution of it ended up using upwards of a dozen zener diodes and the wiring would have been almost impossible to get right on a breadboard. Also visible in the diagram below is the table used to determine the mux outputs.
The third, and final, iteration of the design was a radical departure and put much of the burden in the software to deal with the control. It uses a system of 3 muxes which drive both the LED bank, and the 7-segment display. The idea is that depending on what digits need to be displayed, the software will drive one segment, of one digit at a time, and rapidly bounce between them. The first mux (top in the schematic) is used to run the LED bank, and its lower 2 outputs are the selector bits for the digit selecting mux (bottom). The middle mux is used to select which segment is being driven in a given digit.
Schematic:
Notes:
- All resistors not labeled are 330 ohms
- The outputs of the middle mux are labeled corresponding to their connection to the display for clarity’s sake
Progress Images:

laser cutting the housing

initial plans for coin dispenser
Final Thoughts + code:
I think that for such a simple concept, I really underestimated the complexity of the solution. The biggest problem for me, wasn’t necessarily coming up with a design to solve it, but actual implementation of such a complex circuit was challenging. I spend hours and hours soldering, and redoing connections on the breadboard, and doing it all in such a small space too. Tackling a coin dispenser or digital timer would’ve been enough of a challenge, and trying to do both I ended up getting neither working.
I waited to post the code at the bottom because of its length. Something to note about it are the case statements which is how I cycle quickly based on the loop cycle to drive each separate segment.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | const int coinSwitch = 2; const int dispPin = 3; const int startPin = A3; const int resetPin = A4; const int slider = A5; const int washLED = 4; const int dryLED = 5; const int alarmLED = 6; const int clockMuxA = 7; const int clockMuxB = 8; const int clockMuxC = 9; const int barMuxA = 10; const int barMuxB = 12; const int barMuxC = 13; const int servoPin = 11; /*####### GLOBALS ###### */ int coinCount = 0; long timer = 0; bool counting = true ; bool wash = true ; const long wash_time = 1800000; const long dry_time = 2 * wash_time; bool prevDisp = false ; bool currDisp; bool prevStart = false ; bool currStart; bool prevReset = false ; bool currReset; bool prevCoin = false ; bool currCoin; void writeBars(){ if (!counting) return ; if (timer <= 0){ digitalWrite(alarmLED,HIGH); } else { timer--; } int frac = wash ? (timer/wash_time) : (timer/dry_time); int numBars = frac * 5; //selecting on MUX which LEDs to light up switch (numBars) { case 0: digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,LOW); digitalWrite(barMuxC,HIGH); break ; case 1: digitalWrite(barMuxA,LOW); digitalWrite(barMuxB,LOW); digitalWrite(barMuxC,LOW); break ; case 2: digitalWrite(barMuxA,LOW); digitalWrite(barMuxB,LOW); digitalWrite(barMuxC,HIGH); break ; case 3: digitalWrite(barMuxA,LOW); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,LOW); break ; case 4: digitalWrite(barMuxA,LOW); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,HIGH); break ; case 5: digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,LOW); digitalWrite(barMuxC,LOW); break ; } } long loopCounter = 0; void writeCount(){ loopCounter++; int quarters = coinCount % 4; long oneMod = loopCounter % 4; int twoMod = loopCounter % 3; int threeMod = loopCounter % 5; int thisMod = loopCounter % 2; switch (quarters){ case 0: digitalWrite(clockMuxA,HIGH); digitalWrite(clockMuxB,HIGH); digitalWrite(clockMuxC,LOW); if (loopCounter%2 == 0){ digitalWrite(barMuxA,LOW); digitalWrite(barMuxB,LOW); digitalWrite(barMuxC,LOW); } else { digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,HIGH); } break ; case 1: if (oneMod == 0){ digitalWrite(clockMuxA,LOW); digitalWrite(clockMuxB,LOW); digitalWrite(clockMuxC,HIGH); digitalWrite(barMuxA,LOW); digitalWrite(barMuxB,LOW); digitalWrite(barMuxC,LOW); } else if (oneMod == 1){ digitalWrite(clockMuxA,HIGH); digitalWrite(clockMuxB,LOW); digitalWrite(clockMuxC,LOW); digitalWrite(barMuxA,LOW); digitalWrite(barMuxB,LOW); digitalWrite(barMuxC,LOW); } else if (oneMod == 2){ digitalWrite(clockMuxA,HIGH); digitalWrite(clockMuxB,LOW); digitalWrite(clockMuxC,HIGH); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,HIGH); } else if (oneMod == 3){ digitalWrite(clockMuxA,LOW); digitalWrite(clockMuxB,HIGH); digitalWrite(clockMuxC,LOW); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,HIGH); } break ; case 2: if (twoMod == 0){ digitalWrite(clockMuxA,LOW); digitalWrite(clockMuxB,LOW); digitalWrite(clockMuxC,HIGH); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,HIGH); } else if (twoMod == 1){ digitalWrite(clockMuxA,HIGH); digitalWrite(clockMuxB,LOW); digitalWrite(clockMuxC,LOW); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,HIGH); } else if (twoMod == 2){ digitalWrite(clockMuxA,HIGH); digitalWrite(clockMuxB,HIGH); digitalWrite(clockMuxC,LOW); digitalWrite(barMuxA,LOW); digitalWrite(barMuxB,LOW); digitalWrite(barMuxC,LOW); } break ; case 3: if (threeMod == 0){ digitalWrite(clockMuxA,HIGH); digitalWrite(clockMuxB,LOW); digitalWrite(clockMuxC,HIGH); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,HIGH); } else if (threeMod == 1){ digitalWrite(clockMuxA,HIGH); digitalWrite(clockMuxB,LOW); digitalWrite(clockMuxC,LOW); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,HIGH); } else if (threeMod == 2){ digitalWrite(clockMuxA,LOW); digitalWrite(clockMuxB,HIGH); digitalWrite(clockMuxC,HIGH); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,HIGH); } else if (threeMod == 3){ digitalWrite(clockMuxA,LOW); digitalWrite(clockMuxB,LOW); digitalWrite(clockMuxC,HIGH); digitalWrite(barMuxA,LOW); digitalWrite(barMuxB,LOW); digitalWrite(barMuxC,LOW); } else if (threeMod == 4){ digitalWrite(clockMuxA,HIGH); digitalWrite(clockMuxB,LOW); digitalWrite(clockMuxC,LOW); digitalWrite(barMuxA,LOW); digitalWrite(barMuxB,LOW); digitalWrite(barMuxC,LOW); } break ; } int dollars = coinCount / 4; switch (dollars) { case 0: digitalWrite(clockMuxA,HIGH); digitalWrite(clockMuxB,HIGH); digitalWrite(clockMuxC,LOW); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,LOW); break ; case 1: if (threeMod == 0){ digitalWrite(clockMuxA,LOW); digitalWrite(clockMuxB,LOW); digitalWrite(clockMuxC,LOW); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,LOW); } else if (threeMod == 1){ digitalWrite(clockMuxA,HIGH); digitalWrite(clockMuxB,LOW); digitalWrite(clockMuxC,HIGH); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,LOW); } else if (threeMod == 2){ digitalWrite(clockMuxA,HIGH); digitalWrite(clockMuxB,HIGH); digitalWrite(clockMuxC,LOW); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,LOW); } else if (threeMod == 3){ digitalWrite(clockMuxA,HIGH); digitalWrite(clockMuxB,LOW); digitalWrite(clockMuxC,LOW); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,LOW); } else if (threeMod == 4){ digitalWrite(clockMuxA,LOW); digitalWrite(clockMuxB,HIGH); digitalWrite(clockMuxC,HIGH); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,LOW); } break ; case 2: if (thisMod == 0){ digitalWrite(clockMuxA,HIGH); digitalWrite(clockMuxB,LOW); digitalWrite(clockMuxC,HIGH); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,LOW); } else if (thisMod == 1){ digitalWrite(clockMuxA,LOW); digitalWrite(clockMuxB,HIGH); digitalWrite(clockMuxC,LOW); digitalWrite(barMuxA,HIGH); digitalWrite(barMuxB,HIGH); digitalWrite(barMuxC,LOW); } break ; } } void setup() { pinMode(coinSwitch,INPUT); pinMode(dispPin,INPUT); pinMode(startPin, INPUT); pinMode(resetPin,INPUT); pinMode(slider,INPUT); pinMode(washLED,OUTPUT); pinMode(dryLED,OUTPUT); pinMode(alarmLED,OUTPUT); pinMode(clockMuxA,OUTPUT); } void loop() { int washdry = analogRead(slider); wash = (washdry < 512); if (wash){ digitalWrite(washLED,HIGH); digitalWrite(dryLED,LOW); } else { digitalWrite(washLED,LOW); digitalWrite(dryLED,HIGH); } //add a coin currCoin = digitalRead(coinSwitch); if (currCoin && !prevCoin){ coinCount++; } //dispense a coin currDisp = digitalRead(dispPin); if (currDisp && !prevDisp){ //move the servo up for a hot sec coinCount--; } //reset the timer currReset = digitalRead(resetPin); if (currReset && !prevReset){ counting = false ; timer = wash ? wash_time : dry_time; } //start the timer currStart = digitalRead(startPin); if (currStart && !prevStart){ counting = true ; } writeBars(); writeCount(); } |
Leave a Reply
You must be logged in to post a comment.