FabLab Cept

ARDUINO

I used Arduino 1.8.1 for programming my board. I used arduino board as a programmer.

I followed the following link for the initial set up:

 

http://highlowtech.org/?p=1695

1. The first step is to install Arduino to our system. I needed to install the ATtiny support using the built-in boards manager.

For this I followed these 2 steps :

 

Open the preferences dialog in the Arduino software.

Find the “Additional Boards Manager URLs” field near the bottom of the dialog.

Paste the following link:

 

https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/  package_damellis_attiny_index.json

2. Then go to ' Tools > Board > Board manager' and scroll down till you can see "ATtiny". Click on install.

Now one can see 'ATtiny' added to the list of boards

3. Next step is to program the Arduino to work as ISP. Readymade examples are available for the same. Thus, go to examples and find out "ArduinoISP" code.

4. Next step is to uncomment few lines.

5. Next step is to set the following:

Board : Ardhino/Genuino Uno"

Port : :COM9

Programmer : "AVRISP mkII"

 

Then figure out the position of the connections using ATtiny pinout chart.

Once this is done upload the code. If the green light on Arduino blinks, it means the code is working.

6. Next step is to program the ATtiny using this Arduino board as ISP to blink w.r.t a button. We have "button" code in the examples of arduino library.

 

Once you upload the code, you need to specify the pin number for led and button based on your circuit design.

The code can be found here.

7. Led pin mode is set to "output" and Button pin mode is set to "input". By default button state in the beginning is set to "LOW". Led mode is set to "LOWt" when Button is "LOW". Hence, Led will turn off only when the Button is pressed.

 

The next step was to upload the code and then I had my LED on until I pressed the button.

8. Here is a video of my working board. The code allowed the LED to be on continuously until the button was pressed. Once the button was released, it would turn on again.

button 1 from Arpi on Vimeo.

9. Next I wanted to reverse the connection between LED and button.

 

Now I wanted LED to be "ON" only when the button is pressed, so I changed the code a bit. Now, for "LOW" button state, LED was set to "HIGH" and otherwise LED would be "LOW".

The following video shows the code working.

The files can be found here.