$1 Smallest Arduino DIY

$1 Smallest Arduino DIY
IMG_20170703_175656_HDR.jpg
IMG_20170703_175714_HDR.jpg
Arduino is a excellent platform for prototyping and making cool and creative projects. But when it comes to embedding them into small projects it becomes difficult as they are quite big in size. The other alternative is to go and buy some smd chips and program them via Arduino IDE. But soldering the smd chips manually is not an easy task and you may end up in a whole mess.
But Hopefully There are other alternatives such as Attiny45/85 .But They are priced around $2 - $3 which is kind of expensive as compared to the Chinese arduino clones.
Luckily there exits an another microcontroller from ATMEL named as Attiny13/13A.
Which is cheap and have all the basic functionalities.
Because sometimes you just want to have a pwm output from a microcontroller or any other stuff involving just 1 or 2 pins.
If you don't have the microcontroller in Hand go ahead and buy from here:- Attiny13
Also Check my instructable For more :- https://www.instructables.com/member/HardiqV/instructables/

Step 1: Specifications and Hardware

Specifications and Hardware
IMG_20170703_171921_HDR.jpg
Attiny13 is based on RISC Architecture and is manufactured by ATMEL.
It has 32 X 8 General Purpose Working Registers.
1 KB of Flash Memory ( program memory).
64 Bytes of EEPROM Storage.
64 Bytes of RAM or SRAM.
Over 10,000 Flash Write and Erase Cycles.
4 Channel 10 bit ADC with Internal Voltage Reference.
Internal Calibrated Oscillator. ( You don't need any external crystal oscillator).
In circuit Serial Programming ( ICSP ) For programming the microcontroller.
Upto 6 I/O's pins are available in DIP package.
Upto 4 channel ADC in built.
Upto 2 PWM channel and 1 External Interrupt.
Support For SPI Protocol.
I have also attached the datasheet if you need an kind of reference.

Step 2: Setting UP Arduino IDE

Setting UP Arduino IDE
2017-07-03 (3).png
2017-07-03 (4).png
2017-07-03 (5).png
For programming the Attiny13 microcontroller we will use MicroCore developed by MCUdude.
Here is the Official GitHub link :- MicroCore
Follow These steps very carefully and in this order only
  • Open the Arduino IDE.
  • Open the File > Preferences menu item.
  • Enter the following URL in Additional Boards Manager URLs:
I have attached the photos for the steps , You can refer to them if necessary.

Step 3: Uploading Bootloader

Just like any other Arduino Board this Micro controller also needs Bootloader so that it can understand the arduino Functions and the necessary fuses can be programmed.
For this You need a USBASP AVR Programmer or you can also use ARDUINO AS ISP .
But for this I will be using USBASP programmer.
The connections from the ATTINY13 to the USBASP Programmer is simple.
I have attached the pinout diagram of the Attiny13 .
Connect the MOSI, MISO , SCK, VCC (5v) , RST, GND pins from the microcontroller to the respective pins to the USBASP Programmer.
Next Connect USBASP Programmer to The Computer and Open ARDUINO IDE.
THEN set the parameters as shown in the picture.
Once set then click on Burn Bootloader and after few Seconds The Microcontroller will be Bootloaded.

Step 4: Upload Your First Program

Upload Your First Program
IMG_20170703_174519_HDR.jpg
Now we will upload the program to the Microcontroller.
Go ahead and Paste the following code in Arduino IDE and click Upload.
After Uploading the Program Connect a Led's anode on the pin 2 of the microcontroller and cathode to round through a resistor.
Provide Power to the board (5v).
You will see LED light Flashing .
Now you can change delay timing for different effects.
Here is the Code :-
void setup()
{
pinMode(3, OUTPUT); }
void loop()
{
digitalWrite(3, HIGH);
delay(1000);
digitalWrite(3, LOW);
delay(1000);
}

Step 5: Another Example Program

Another Example Program
IMG_20170703_171921_HDR.jpg
In this example we Will read a Potentiometer and convert it's values to drive a led through Pulse Width Modulation (PWM).
Go ahead and upload This Code to the Microcontroller:
#define LED 1
int data;
void setup() {
pinMode( 1, OUTPUT);
}
void loop() {
data = analogRead(A3);
analogWrite( LED, data/4);
}
attach a potentiometer of value 10K to the 2 pin of the microcontroller.
and attach a LED on the 5 pin of the microcontroller.
You will see that the LED brightness changes as You change the value of Potentiometer.

Step 6: FINISH

FINISH
IMG_20170703_175656_HDR.jpg
Of Course This is just a start and this microcontroller is lot more capable of doing other things . After playing around this microcontroller you will find that the program space is quite low. This space can be improved my using PIN manipulation and getting rid of digitalWrite and digitalRead Commands.
I will make future posts on this board so that you can understand better.
Also check my instructable for more :- https://www.instructables.com/member/HardiqV/instructables/

No comments

Powered by Blogger.