Make a microcontroller board with an output device.
This is my second try to use an output device with one of my boards, I am describing my first (failed) attempt at the bottom of the page
To make life easier for my, I am planning to use my blinking board from week 7 to do this weeks assignment:
Before I could program my board I first needed to figure out how my servo motor works. I found this website to be very helpful.
I want to use the 2x3 header to run a servo motor (HKSCM16-6 Single Chip Digital Servo (6V)). The servo takes 4.8-6V. The dark brown wire is GND, the red one is VCC and the orange one reads the output from the microcontroller (CONTROL). The bottom row of my 2x3 header has GND, VCC and MOSI. The MOSI pin on the attiny44 can be used as an output pin for a servo motor (it can pulse-width modulate). I decided to switch the VCC and CONTROL (S) pin of the servo motor:
edit: I should have just disconnected the cables from the original header, switched VCC and S and connected the wires to a female 2x3 header.
I used arduino to write c code. To drive the motor poked around the internet a lot to see what other people had done before. I tried to use several arduino libraries for controlling servo motors without much success. I ended up using a piece of code I found here. I wanted to wiggle the motor for a few seconds after touching the button. With help from Andy Spielberg, I wrote a program in c code using arduino that does exactly that. I also used the arduino tutorials: Boolean and while loops:
Touching the motor does this:
I am one of the EHS representatives in my laboratory, one of the most annoying part of the job is that I have to tell people to close their waste bottles. I use the phrase "close your waste bottle" at least three times a day! This week I want to make a microcotroller board with a button and a speaker. When you press the button it should say "Close your waste bottle." so I don't have to.
I am using an attiny44 microcontroller, a PSR-23F08S-JQ speaker, a button and I also included a battery connector. The speaker needs to be connected to PA7 of the attiny44 (it can be used for PWM output) and ground. The battery is connected to ground and to a regulator with an output of 5V. To make the board more compact, I will connect the battery and the speaker using two 2x2 headers.
I used the modela for milling, no problems with milling or stuffing the board.
I downloaded a mp3 sample from google translate saying "Close your waste bottle". I then converted it to 8-bit mono, then you can convert the audio sample into a numeric code that can be pasted into the Arduino program. For this I downloaded an audio ancoder from highlowtech. The resulting audio code consists of three-digit numbers separated by commas:
Here are the audio files before and after b-bit conversion:
I used arduino to write my C code. My sketch is based on Micheal Smith's program. The only thing I changed, is the pin nubmer. He is using pin 11 on an attmega, I changed this to pin7 on the attiny44. I thought I was all set to start programming my board and connected it to my FabISP.
I couldn't upload my sketch, and I got a lot of error messages similar to : "error: 'TCCR2B' was not declared in this scope". After googling the issue, I realized that the original code which written for an attmega wich was using a timer 2 that our attinys don't have. The timer0 in the attiny44 is supposed to work similarly and I followed the suggestion to change all the expressions that refer to timer2 to timer0:
By the time, I had the solution it was too late for me to program and test the board. Working on it!
edit: I actually did not get it to work. I started wokring on moving a servo motor instead (I,ll be needing it for my final project)