This week finally we did output devices! I was waiting for this for a long time. In my mind there's a lot of applications that I would love to try, for example using a distance sensor to output sound! That would be amazing!
Im also really happy because I'm becoming better at designing and soldering! I'm doing it faster and the most important thing is that,little by little, each time I make a new board, I understand electronics more!
Add an output device to a micro-controller board I've designed
Program the board to do something
First, we had our weekly lecture with Neil Gershenfeld, you can watch it here.
This week was pretty straight forward, we had to design a board that outputs something. We could try to do very different stuff, for example Charlieplexing led array to make a lot of led blink, a sound output to make some melody or program a motor to make certain moves.
So for the first try, I did a sound output. I was so happy when it started to sound!
First step, design it in eagle. Now I can say I get eagle, I understand what Im doing, it's so good! Just a few weeks ago all this electronics design stuff was unknown to me and being able to produce my own boards now is just amazing. There's a lot I still have to learn, but starting to feel confortable working with electronics is a great feeling.
I spend some time trying to find the correct components in eagle because it was not clear, I just had Neil's board layout example as a reference, specifically, I was troubled with the mosfet and the voltage regulator. So if you are designing this board be careful because this to components are similar when you look at them, you will see that when you start to stuff your board.
This is the list of components I used.
ATTINY45SI x 1
AVRISPSMD / 2X03SMD x 1
REGULATORSOT23 x 1
PINHD-2X2-SMD 2X02SMD x 2
RES-US1206FAB / 10K x 2
NMOSFETSOT23 x 1
You can access the eagle file: here
Next step: Milling the board. This week I used a different machine for milling because the SMR-20 wasn't available, so I used the MDX-20, which is a little bit older but the process is the same. Also, this was the first time I used fab modules in ubuntu; the interface is a little bit different, but the steps are the same.
Open Terminal and launch Fab Modules.
Then, a pop up will appear. Select input format, output process and workflow.
The main interface of Fab Modules will appear, there you set: PNG source and the milling parameters, in this case I used the same settings that I've used before in Electronics Production week. Then you click on make path. In the middle window you will see the calculation of the paths.
Remember to set your home (0,0,0). In this machine you do it by setting the reference in the X,Y fields in the interface. Z is set manually by moving the bit close to the board and make it lose until it touches the surface and tight it again.
After that the next step is to send the file to the machine; click on make .rml and then send it!
You will se the progress of the job in a new pop up window.
Then soldering time. No news here, Im just getting a little faster at it, even with the small components.
* Be careful here, do not mix the mosfet with the voltage regulator.
Pay special attention when soldering the voltage regulator, in my case the milling machine didn't mill the path right in this point because it was to small, so i had to retouch this area and other milling leftovers that where to close to the paths by hand using a hobby knife.
And this is the result! This one wasn't that neat but it works. :)
Now it was time to program it. It was also pretty straight forward. I had a lot of practice programing during Input Devices week. Just be careful to check your connections before plug in the usb port of your computer, if you don't check with a voltmeter, you are at risk of a short circuit and you'll have to start all over again.
For programing in a Mac, these are the steps:
First, for programing this board you need to use your FabISP. Connect it and check if it is detected on the computer.
Then, plug the ISP with the Sound Board you just made and the 9V Battery.
Go to the directory where you have the program files. You should have these files: hello.speaker.45.c / hello.speaker.45.make
Then type this
make -f hello.mic.45.make program-usbtiny. By doing this, you are using the make file to upload the program contained in the C file to your board's microcontroller.
If you get the successful program upload message you are done! You can unplug the FabISP and plug your speaker.
The first time I tried to program it, I was getting a "error 1". This happens because your ISP is not reaching the Sound Board due to: no power, misconnections or malfunctioning components.
After checking everything I found that the problem was the battery, it was out of power, so after changing it the ISP worked! After that you should be able to hear some notes. But then another problem, I just got a clicking noise.
After spending some time checking everything again, I found that the problem was the 9V battery, it was low on power, I could program the board with it, but the energy wasn't enough to output the sound. So after changing it for a new one, everything was working perfectly!
* In the future, my plan is to modify this board to integrate a sensor and try to turn it into something more interactive.