Tiny Micro-controller Project for Under $2 Bucks

by JustinR138 in Circuits > Microcontrollers

1291 Views, 9 Favorites, 0 Comments

Tiny Micro-controller Project for Under $2 Bucks

20180505_093849.jpg

There is much on the internet about getting started with Micro controllers. There is much choice out there, so many ways to program them whether or not you start with the bare chip itself, development boards or more comprehensive SOC(System On Chip) gadgets also many ways to program them.

So for those who are interested, this is one of them.

USBASP + AVR ATTiny85 mini USB dev board (By Digistump)

I like this combination because its a really cheap way to get a project going for a very small form-factor Arduino platform, these chips are so small you can put them in practically anything unlike the unwieldy Unos.

The board im using is a cheap digispark kicksarter knockoff coming in at a whopping $1 on ebay with internation free shipping.

The programmer is the open source USBASP programmer also available for around the same price on ebay or AliExpress

This instructable is the end to end process of getting the dev-board to do something

An easier route is to acquire a real digispark from digistump http://digistump.com/products/1

But this project seems to be on hold and these cost $8US

If you have one of these you don't need a programmer as it has and ardudino Micronucleus boot loader pre-flashed to the chip. This means you can use the program directly to the chip from your computer. But the downside of this is that the boot loader takes uses a good portion of available resource on the chip limiting what you can do so for what its worth, this is about USBASP and NOT the Micronucleus

Acquire Your Parts

digispark.jpg
HTB14POXdMb.PuJjSZFpq6zuFpXaA.jpg
wires.PNG

Go to ebay or aliexpress and search up

  • "attiny85" for the board
  • "usbasp" for the prgrammer and
  • "jumber wires" for the wires (optional if you can find some lying around)

Put It Together

20180505_094250.jpg

When your hardware finally arrives start with soldering

Solder the pins breakout pins to that come with the package to the board. This is optional. if you don't have a soldering iron you can just twist the wires on but this is not recommended as the contacts will not be the best

In this example, I, for some reason soldered wires directly the the power terminals but you can use the break out pins to do this also

Wireing

20180505_094418.jpg
20180505_094647.jpg
pin colours.jpg

Connect the wires as per images. I have used this combination but you can use any you want of coarse they just need to correspond correctly

to the board:

  • p0, p1, p2 = green, blue, red
  • 5v, GND = red, green (VIN not used)

the connector:

  • see diagram for corresponding cable connection

Software - VSCode

download vscode.PNG

Now you are wired up you will need to setup your software environment

This includes:

  • drivers
  • development environment

First download Visual Studio Code. (the best env i have found so far)

You can get this from https://code.visualstudio.com/download

Download and install it

Install the PlatformIO IDE Plugin

install platformIO IDE.PNG
reload vscode.PNG

Click on the extensions button on the bottom left side bar and search for PlatformIO

Install it and reload

Click on the little house button bottom left status bar to open the Platform IO home page if it does not come up automatically after the plugin install

Create a New Project

new project.PNG
name the project and select attin85 generic board.PNG

In the project wizard name the project and choose the board

The board must be

Attiny85 (Generic)

The framework must be

Arduino

Configure Development Environment for USBASP

setup plaformio.PNG

Setup the programmer in the PlatformIO project settings file platformio.ini

Add these lines to the platformIO.ini file:

upload_protocol = usbasp
upload_flags = -Pusb

Plug in You Programmer

20180505_095111.jpg

Plug in you programmer

Setup Drivers

f1 home.png
20180505_121655_002.mp4

Your USBASP hardware will need drivers for your computer to communicate with it.

Download Zadig from here

Plug your USBASP usb device into a USB port on your computer

Run the downloaded Zadig program you downloaded

Install the Winusb driver for usbasp

If your system does not recognize the hardware, send me a note and maybe i can help but generally this should work out of the box.

Write Your Code

write your program.gif
#include 
void setup()
{
// put your setup code here, to run once:
pinMode(1, OUTPUT);
}
void loop() {
digitalWrite(1, HIGH);
delay(1000);
digitalWrite(1, LOW);
delay(1000);
// put your main code here, to run repeatedly:
}

Compile and Upload Your Program

20180505 121655 002 1

Make sure you have your ATTiny85 board wired to your programmer and its all hooked up.

Press the keys Ctrl+Alt+U to compile and upload the program