Cheap AVR/51 Development Board
by Silvius in Circuits > Microcontrollers
35949 Views, 40 Favorites, 0 Comments
Cheap AVR/51 Development Board
I recently discovered STC microcontrollers produced by TSMC. Being curious about these microcontrollers I started looking for a development board for them.
After some searches on google / ebay / AliExpress / I decided to buy this PCB that I ordered on AliExpress at an affordable price of $ 10 / 2 pieces (In fact I reordered ten pieces of PCB in total and five complete kits for me and my team)
After analyzing circuit I realized that may be used for ATMEGA162, ATMEGA8515, AT89S51, AT89S52 besides STC8051 and that made it interesting enough to continue.
After some searches on google / ebay / AliExpress / I decided to buy this PCB that I ordered on AliExpress at an affordable price of $ 10 / 2 pieces (In fact I reordered ten pieces of PCB in total and five complete kits for me and my team)
After analyzing circuit I realized that may be used for ATMEGA162, ATMEGA8515, AT89S51, AT89S52 besides STC8051 and that made it interesting enough to continue.
PCB
The PCB is very well made. and the component side is very good marked.
Although the markings on the PCB are self-explanatory I felt the need to have a circuit diagram of it (and some sort of user-manual).
Although the markings on the PCB are self-explanatory I felt the need to have a circuit diagram of it (and some sort of user-manual).
Schematics
I made circuit diagram in Kicad (In my opinion the best freeware software for drawing electronic diagrams and printed circuits boards).
For printing I recommend downloading the PDF file attached. Although it is in A3 format can be printed on A4 or Letter.
KIcad project files will be available after completion of the PCB design (will be posted as reference are not required for this Instructables, nor for the use of the development board). For this tutorial it is sufficient diagram in PDF format.
For printing I recommend downloading the PDF file attached. Although it is in A3 format can be printed on A4 or Letter.
KIcad project files will be available after completion of the PCB design (will be posted as reference are not required for this Instructables, nor for the use of the development board). For this tutorial it is sufficient diagram in PDF format.
Overview of Components
All components will be detailed in the following steps
Resistors
We started installing the small components. This step is about resistors.
Diodes and LEDs
Capacitors and Transistors
Small Connectors and Switches
Last Components
Completed Boards.
For programming ATMEL microcontrollers I used a programmer USBASP compatible and AVRDUDE .
Attention to the JTAG interface. If you want to use the entire PORTC must disable the JTAG interface. Anyway development board does not have JTAG connector.
For programming STC microcontrollers we do not need specialized programmer.
It only requires a serial cable if your computer has serial port. If not, will work with a USB to Serial adapter (work with the cheaper and slower adapter found with $ 3 on ebay). But there is a catch: It is necessary to use a specific software for these microcontrollers.
I will not insist on programming STC microcontrollers because it is not the purpose of this intructable. Additional information (including data sheet in English) can be found on openhardware.ro
I will supplement with additional information as soon as possible
With ARDUINO and ATMEGA162
Development board can be made ARDUINO compatible if used with ATMEGA162 microcontroller.
(Note: This is not supported by the official Arduino libraries)
To use ARDUINO need to be made the following changes:
1. In the <arduino>\hardware\arduino\avr\boards.txt file, add these lines:
##############################################################
atmega162.name= ATmega162
atmega162.upload.protocol=arduino
atmega162.upload.maximum_size=14336
atmega162.upload.speed=57600
atmega162.bootloader.low_fuses=0xFF
atmega162.bootloader.high_fuses=0xD8
atmega162.bootloader.extended_fuses=0xFB
atmega162.bootloader.path=optiboot
atmega162.bootloader.file=optiboot_atmega162.hex
atmega162.bootloader.unlock_bits=0x3F
atmega162.bootloader.lock_bits=0x0F
atmega162.build.mcu=atmega162
atmega162.build.f_cpu=16000000L
atmega162.build.core=arduino
atmega162.build.variant=atmega162
##############################################################
2. Make a folder
[<arduino>\hardware\arduino\avr\variants\atmega162\]
in this folder save file [pins_arduino.h]
3. We will overwrite the file iom162.h in folder
[<arduino>\hardware\tools\avr\avr\include\avr\] with the file attached here.
4.File [optiboot_atmega162.hex] will be saved to:
[<arduino>\hardware\arduino\avr\bootloaders\optiboot\]
(Note: This is not supported by the official Arduino libraries)
To use ARDUINO need to be made the following changes:
1. In the <arduino>\hardware\arduino\avr\boards.txt file, add these lines:
##############################################################
atmega162.name= ATmega162
atmega162.upload.protocol=arduino
atmega162.upload.maximum_size=14336
atmega162.upload.speed=57600
atmega162.bootloader.low_fuses=0xFF
atmega162.bootloader.high_fuses=0xD8
atmega162.bootloader.extended_fuses=0xFB
atmega162.bootloader.path=optiboot
atmega162.bootloader.file=optiboot_atmega162.hex
atmega162.bootloader.unlock_bits=0x3F
atmega162.bootloader.lock_bits=0x0F
atmega162.build.mcu=atmega162
atmega162.build.f_cpu=16000000L
atmega162.build.core=arduino
atmega162.build.variant=atmega162
##############################################################
2. Make a folder
[<arduino>\hardware\arduino\avr\variants\atmega162\]
in this folder save file [pins_arduino.h]
3. We will overwrite the file iom162.h in folder
[<arduino>\hardware\tools\avr\avr\include\avr\] with the file attached here.
4.File [optiboot_atmega162.hex] will be saved to:
[<arduino>\hardware\arduino\avr\bootloaders\optiboot\]
Arduino IDE
Arduino configuration is finished now.
I use the programmer USBASP bought for $ 3 on AliExpress.
I have not yet tested the bootloader because my USBASP programmer stay connected to the development board all the time. :)
It is necessary considering using almost all available processors for this board. And also not just use Arduino/Processing, but other programming languages (C, ASM).
I use the programmer USBASP bought for $ 3 on AliExpress.
I have not yet tested the bootloader because my USBASP programmer stay connected to the development board all the time. :)
It is necessary considering using almost all available processors for this board. And also not just use Arduino/Processing, but other programming languages (C, ASM).
With LCD16x2
Here's a sample code to use a 16x2 display.
I used an old display without backlight so I can take the picture. :)
//------------------------------------------------------------------------------------------------------------------------------
// include the library code:
#include <LiquidCrystal.h>
/*
* LCD RS pin to digital pin 8
* LCD Enable pin to digital 19
* LCD D4 pin to digital pin 31
* LCD D5 pin to digital pin 32
* LCD D6 pin to digital pin 33
* LCD D7 pin to digital pin 34
* LCD R/W pin to ground ... in this case digital pin 9 -> LOW
*/
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 19, 31, 32, 33, 34);
const int RWPin = 9;
void setup()
{
// set the digital pin as output:
pinMode(RWPin, OUTPUT);
// R/W Pin to ground
digitalWrite(RWPin, LOW);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.setCursor(0,0);
lcd.print("Arduino");
lcd.setCursor(0,1);
lcd.print("atmega162");
}
void loop()
{
}
//------------------------------------------------------------------------------------------------------------------------------
I used an old display without backlight so I can take the picture. :)
//------------------------------------------------------------------------------------------------------------------------------
// include the library code:
#include <LiquidCrystal.h>
/*
* LCD RS pin to digital pin 8
* LCD Enable pin to digital 19
* LCD D4 pin to digital pin 31
* LCD D5 pin to digital pin 32
* LCD D6 pin to digital pin 33
* LCD D7 pin to digital pin 34
* LCD R/W pin to ground ... in this case digital pin 9 -> LOW
*/
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 19, 31, 32, 33, 34);
const int RWPin = 9;
void setup()
{
// set the digital pin as output:
pinMode(RWPin, OUTPUT);
// R/W Pin to ground
digitalWrite(RWPin, LOW);
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.setCursor(0,0);
lcd.print("Arduino");
lcd.setCursor(0,1);
lcd.print("atmega162");
}
void loop()
{
}
//------------------------------------------------------------------------------------------------------------------------------
Last Word
Into final, result is to get a PCB designed mainly for exotic processor (STC51) and extend the possibilities up there, it can be used with a friendly environment like Arduino.
PS.
Into the next few weeks I will update information on openhardware.ro
I will provide code in Arduino and C to explore all possibilities of the board.
and I work on a new Instructable for ATmega32 development board, compatible Arduino, designed from scratch.
PS.
Into the next few weeks I will update information on openhardware.ro
I will provide code in Arduino and C to explore all possibilities of the board.
and I work on a new Instructable for ATmega32 development board, compatible Arduino, designed from scratch.