Output devices

Week 9

This week our group assignment is to measure the power consumption of an output device(Link: The Group Assignment is Here!). Individually we have to add an output device to a microcontroller board we've designed, and program it to do something

Tools: Arduino IDE, PCB Mill, Soldering Iron, Eagle
Date: 11.18.2020

For my Project, I want to be able to use capacitive sensing as a trigger to inflate and deflate a blood pressure cuff. Once this happens, we can hopefully feel the hand grabbing on to us, which is supposed to trigger the emotion of someone missing you. And in todays day and age, i believe being reminded that someone’s missing you is very important. My blood pressure cuff's air is controlled by a peristaltic pump which circulates the air inside of the cuff. You must have seen a blood pressure cuff in action. A ball-shaped pump handheld, is squeezed to pump air inside. I am replacing the ball-shaped pump with a peristaltic motor. The idea is that when the motor runs in one direction, it will fill air in, when in the other direction, it will throw air out and hence when the cuff is around your hand, you will feel the grip tightening on you. In an ideal case scenario, your loved one will be touching a screen (capacitive sensing) in one part of the world and you, here, will be taken by surpris when the cuff starts to tighten around your arm and that's the indication that they are missing you.
The peristaltic pump is securely latched onto the motor. Its two pipes are connected to the two pipes of the bloodpresssure cuff.
For my output week, I am keen on having the servo motor be triggered with code and eventually I want to be able to manipulate it's speed etc.

Motor Clockwise, Anticlockwise Program The first thing I did was write a program that can control the motor to run clockwise and anticlockwise. The important thing to note is calling pin names in Arduino is not exactly calling the pin number. We have to refer to this schematic again:
datasheet schematic>



My motor one leg is connected to Pin 12 on the chip, which can be called using its port name PA2 (which can be a bit complicated to call) or by the brown/blue numbers, in this case 9. Similarly, the other leg is connected to Pin 11 on the chip, which can be called using its port name PA1, so I call it using 8 in Arduino. Here is my code:



After writing this, I compile the code by clicking the verify (checkmark) button in the Arduino IDE. I then copy the .hex file from my Hexes folder into the folder containing the sketch. Then I go into CMD and cd into the Arduino folder containing the sketch and input: python3 C:\Users\jkrit\Downloads\pyupdi-master\pyupdi-master\updi\pyupdi.py -d tiny1614 -c /COM9 -b 115200 -f motor_2.ino.hex -v I found out that having the -v on the end makes it take longer to flash the code onto my board because it prints everything. So I removed that from future use for faster uploads.
After writing this, I compile the code by clicking the verify (checkmark) button in the Arduino IDE. I then copy the .hex file from my Hexes folder into the folder containing the sketch. Then I go into CMD and cd into the Arduino folder containing the sketch and input: python3 C:\Users\jkrit\Downloads\pyupdi-master\pyupdi-master\updi\pyupdi.py -d tiny1614 -c /COM9 -b 115200 -f motor_2.ino.hex -v Here is the result:

However, i didn’t get it right in the first 20-30 tries. Every time I would plug in the board to try and run the code, my board would fry and i would smell solder and see smoke. Trying to understand the issues, I had to debug everything, starting from the Attiny. This wild goose chase finally got me to a point where i realized that mosfet which was supposed to control the peltier chips, which would heat up the cuff was the culprit. The way the mosfet was drawn on my board, it wasdrawing current directly from VCC, while it should’ve drawn current from VDD. Refer to the following schematic.





So, i made some addendums to the circuit, i cut the trace here, and reconnected it here. This dind’t help however, the board was still getting fried. For now, what i knew was this - that the moset was frying the circuit everytime i connected it. This led me to solder and resolder through 15 tinys over the course of 4 days.


Then one time it all worked, i could control the motor through capacitive sensing. I decided to replug the peltier to see if i could get it all to work in sync, since i had added a diode this time, so thought i was gpong to meet with success. Worst mistake ever. The tiny fried yet again. And by this time, id used it over so many times, that the traces got discoloured.








Here's the video where the motor actually managed to fill the bladded with air!