Embedded Programming


This week's assignment, was to program our "Hello_World" Board.

last week I designed my board with a 4 button array conected to 1 pin, with the purpose to make a 4 key mini piano, so this week I was decided to make it sound.


The first challenge was to connect the board to our computer allowing communication between the devices,and being able to program the board. this were de requirements for acomplishing that:


-PC with Windows or Ubuntu
-Hello world board
-Programmer (ISP)
-FTDI cable
-ISP cable


-Arduino IDE
-Attiny libraries
-USBtiny driver
-FTDI drivers


For programing the board I used the Arduino IDE interface on Windows:

After installing the drivers, you have to paste the Attiny libraries in Arduinos's "hardware" folder, next make the connections :


The FTDI Cable connected to the hello board and to one USB port of the computer + the ISP cable connected to the Fab ISP and to the hello board + a mini USB cable connected to the Fab ISP and to another USB port on the PC.




Next on "Tools" menu you have to set:


- Board : ATtiny44 (external 20 MHz clock) if you are using an external resonator, if not choose Internal 8 MHz

- Serial Port: in my case is COM6, yours can be different (check on windows's device manager)

- Programmer: USBtinyISP




Now we have to program the board: first I practiced with an standard Arduino UNO board trying to accomplish my goal, to make a 4 key piano using only 1 analog input. Looking arround on the internet i found the way to do it, it wasn’t hard to program.


I also used the Sublime Text 2 software that is a text editor that helps by coloring the parts of the code acording to the sintax in this case C++, you can download the program here


This is my program for the Arduino UNO board:


It triggers a different tone function depending on the reading of the value on the analog input, it also triggers a message on the serial monitor according to the pressed button, you can configure the output, the frequency and the duration in each tone.



Since it worked on the Arduino UNO board I thought that I had the problem solved for my hello world board, well I was wrong, because the "tone()" function is not supported by the ATtiny chip.

I had to find a different way to do it.


I found the Arduino's "melody" example and I mixed it with my older program making some adjustments, I couldn’t make the serial port work., but I achieved the sound that I wanted no often the Arduino’s sound was way better it also flashes the led when a button is pressed.


This is my program for the Hello_World board:



Finally here is a video to show the functioning of both programs:



I also tried the Ardublock, that is a visual programing interface, and is installed as a tool on the arduino IDE, it is really easy to use, but is limited, I still prefer the Arduino default interface. You can download the software and check tutorials here