input devices


-----------------------------------------------------------------------

this week’s assignment was to measure something by adding a sensor to a microcontrollers board that we have designed and for it to read in values onto the computer.

i decided to use a thermistor, because I hope to be using one in my final project. my final project is going to be a rigged out chair on which the armrests will have a coffee mug warmer on one side and a phone charger on the other. For the coffee mug warmer, I want my input device to be able to read in the temperature on the mug and once it cools to a certain temperature, automatically restart the heating device to warm it up.

for this week, I created two separate boards: one with a thermistor and two LED lights (that would react to different temperature thresholds) and one with the thermistor on a separate board (more along the final project thinking if I want to put the majority of the electronics somewhere else and just have the thermistor attached to the heating source).

milling


once again, milling took up a long portion of the week and caused me more problems than anticipated. the problems: 1) after the mods program is done milling the board (traces and/or edges) it won’t pick up the mill to set it back to the zero position, it will drag across the board either disconnecting traces and/or cutting the board in half sometimes and 2) the size of one of my .png files would not convert into the mods program. in my macbook eagle to mods flow, no matter what size i save the file as (usually i save as 1000 dpi), i need to double the dpi in mods to get the correct dimension of the board. for some reason, on my smallest thermistor board, mods would read and display a correct, full tool path for the original 1000 dpi file, but, when I changed it to 2000 dpi for the correct size of milling, it would give me a much more limited tool path that would not cut all the traces.



the last problem i was having does show growth to me from this class, though. I think at the beginning, i wouldn’t have even looked at the tool path to make sure it is correct before hitting send and milling the file (I know reckless and not the smartest), but now i am much more careful, and mindful in each of the steps i am taking.

the milling/mods problems are consistent and random, so sometimes i get the dragging, and sometimes I don’t. I wonder if it has something to do about how i’m saving the eagle file, and will inquire more about that next week. i have inquired in the past with jen and shah in the arch shops, but haven’t received a conclusive answer or reason.

board 1: (with LEDs)






board 2: (separate thermistor)








boards are finally milled, soldered on parts!



i did find some issues when soldering on parts too, especially with the board with the separate thermistor. my plan had been to add extra pads to each of the boards and have wires soldered to connect them, and theoretically i think that’s fine. i did forget to add a vcc pad connection when designing the board, so i was just going to solder it onto a vcc line. of course the connection wasn’t the most solid and it broke apart. i think it the future i’m going to try to add a pin header and some female to female wire connectors to make things easier.



programming


the programming i hoped would not be a struggle for me, but of course, it was, but honestly, a bit of a fun struggle, i was learning a lot this week!

so due to the struggles and uncertainties in the separate thermistor board, i decided to focus on my LED board first. my first task was to just try to program the board to do something, and I chose to try to light up the LEDs, because that is the easiest visual response that the board is working, and then work with the thermistor. I decided to use arduino, because I have found that has been the easiest tool for me, and i have begun to understand the coding language better and feel more comfortable. I hooked up my USBTiny and my board, and started programming.

task 1: LEDs


i decided to code up a simple program to program to turn on and off the LEDs every 4 seconds, and then also display a serial output of which color is lighting up. turns out i soldered one of the LEDs in the wrong direction, so i will just be testing if the one LED would turn on and off and display “Red” or “No.”

i was of course, getting a ton of errors in this process. i looked up some tutorials on how to get arduino to talk in serial, and was using the arduino website’s sample code. However, arduino was not liking how i was trying to talk to Serial, and I kept on getting a “’Serial’ not declared in this scope” error:



I decided to look elsewhere and search for people who had a similar problem, and they recommended using the tag #include , and then a SoftwareSerial serial(A0, A1) to define where the serial communication should be found in the microcontroller. this seemed to clear up that error, and the rest of my code ran fine, so I uploaded it.



my light was lighting up every four seconds! (i apparently did not catch that on video, but will insert it later)



but there was no serial output. AH.

I tried a bunch of problem-solving things: 1) try uploading the code again and hoping it work (big shocker, it didn’t), 2) use a voltmeter to check if i had any shorts going from the serial communication to the microcontrollers or anywhere else (everything looked good), 3) someone else ran their board with my code (serial communication popped up and was displaying words) — not great for me, i probably have a problem on my board hardware, 4) try my board on someone else’s computer with their code (didn’t work, so something is definitely very wrong here, awesome), 5) try again on my computer and get a weird error message (now this is just spooky)

i was now getting a “avrdude: initialization failed rc=-1” error?? which means that something is wrong on my wiring. it was just super weird because my code was uploading before fine, but now i was getting this error just because i ran my board on someone else’s computer? i decided to take a breather for a couple hours and then come back during some office hours to get some debugging help.



i am so thankful to the eecs ta, Ben, this week, who helped me figure out this problem.

some more problem solving things we did: 1) he plugged in my usbtiny and LED board into his computer, and it wasn’t reading — something is definitely wrong, 2) he plugged in his usbtiny and my LED board in, and it was reading — something is wrong with my usbtiny (which spooky weird because it was working an hour ago, no matter, one problem solved), 3) tried to read serial, still wasn’t working — something in the board isn’t working 4) a common problem in arduino is that it can read the board in at a different time rate than maybe you think it is, so we pulled out an oscilloscope and measure the voltage and frequency wavelengths. (this part was actually very interesting and i was learning a lot). 5) then he did something to find out the lowest level my board was reading at and went to a website to see what the fuse rate was (pic below), and turns out my board was reading at 8MHz and not the internal 1MHz that i though.





with that, we changed it to 8MHz, re-burned the bootloader and IT WORKED. I WAS RECEIVING SERIAL COMMUNICATION. if you can’t tell, i was ecstatic.



task 2: thermistor


i now moved over to trying to get my thermistor to read. i wrote out a simple code that would display the voltage and the temperature, and it worked!! it worked incorrectly, but it worked! my temperature seemed to decrease as it got warmer, so something is wrong in how i’m converting the temperature, but i am getting values, and for that i am thankful.