How to Build an AVR Development Board > 아두이노



아두이노 강의 리스트

※ 가장 하단이 첫강좌입니다

VicPy | How to Build an AVR Development Board


※ 영상을 선명하게 보기 안내
  1. 유튜브 영상에서 오른쪽하단에 톱니바퀴를 클릭합니다.
  2. 팝업목록에서 "품질" 선택하세요.
  3. 원하는 해상도를 선택해주세요.
※ 모바일에서 Wifi가 아니라면 데이타가 소진될 수 있으니 주의바랍니다.
VicPy님의 아두이노강의 청각장애인을 위한 자막

 the Ben Heck show is brought to you by

element 14 the electronic design
community and online store built for
engineers and hobbyists alike join now
and browse the store at
Benjamin J hekkador was a mild-mannered
graphic artist until he was bitten by
the electronics bug now every week he
takes on new projects shares tips and
tricks and answers your viewer questions
on the Ben Heck show hello and welcome
back to the Ben Heck show I've used this
custom-built AVR development board and
past episode and we've had several
people ask about it so today I'm going
to show you how to put together one of
your own and point you in the right
direction of the schematics and diagrams
you'll need online let's get started but
first the news today in Ben news I'd
like to show you this new 3d printed
elevator I made for my ghost squad
pinball machine the ball comes in here
rolls down and the hella Vater can come
down like this and make the ball go into
a secret path 3d printing was great I
was able to 3d print a rack and pinion
sidewalls for the elevator and even
these main supports so yeah it's great
adds quite strong and it's
three-dimensional so this is a great
example of what you can do with 3d
printing takes a while to print all this
but it's worth it let's start by talking
about the differences between an in
circuit serial programmer or ICSP and a
serial bootloader the in circuit serial
programmer usually requires you to have
a little box the programmer this box
connects to your computer via a USB
cable and then it connects to your
development circuit or microcontroller
be a 6-pin programmer now these boxes
vary depending on what kind of chipper
you're using there's a certain one for
an AVR and a different one for a pic but
they're basically do the same thing and
then typically user the program on your
computer such as AVR studio 6 or a
standalone program that flashes hex
files this is the method typically used
for professional development and also
flashing bootloader
now let's talk about a serial bootloader
which is what the arduino uses you need
to flash your microcontroller with a
boot little program which sits at the
beginning of memory you need to flash
the chip using your in circuit serial
programmer but once you do you're able
to program the chip using the RX and TX
serial communication pins however you
need some sort of interpreter between
that so usually have a USB to serial
adapter typically an FTDI chip or
another small marker controller that
takes your USB commands translates it to
the old-school rx TX and then your chip
programs itself from there so if you
want to flash your own chips for
development you should definitely get an
in circuit serial programmer but then
you can do it this way which is a little
easier knowing that let's talk about
what we're going to build in this
episode we're going to take a little PCB
and put a marker controller socket here
we're going to use the HP mega 3 2 8 and
also a smaller socket here for the 80
tiny so you can program either them
there'll be a 6 pin in circuit serial
programming header here which works with
the AVR programmer
well the crystal on board for driving
the larger market roller via power
switch DC jack and plenty of pins so you
can pin out what you're doing so you can
use this to flash the chip but then you
can just pull the chips out and put them
in another solution
here are most of the parts we need
here the microcontrollers sockets switch
power jack unplug capacitor indicator
light crystal and the header and we also
have these headers here
female headers for adding other things
to it so let's get started this is
important I got this off the Arduino
site it's a schematic for thered we know
Uno now this is the part we actually
need to worry about this is the market
controller and we can use the same pin
out for the larger ship and the 80 tiny
and this part of it right here that's
the in circuit serial programmer so
that's how it's going to be connected on
our board so this is the most important
thing right here we need to copy I added
a little header here so the crystal can
be removable these micro controllers
have internal crystals but if you want
an external crystal about the option to
be there I've started with the header
here this is the pins 28 down through 23
these are the analog connections as you
can see in the schematic so I just
simply you know use little bits of wire
to jump it over manual soldering fun do
it all the time
I better the reset button with a pull-up
resistor the pull-up resistor will put
positive voltage here on the reset line
when you push the button it pulls a
reset line low resetting it and I'm
going to tie the reset lines of both
processors the same pin because you're
not going to use both in the same time
one of the others so I'll attach this
one here and then lock for the reset
switch down here I have common ground
lines wired in see how we go to the
reset switch the tiny end 18 mega is
also a positive voltage rail here and
positive and negative voltage also goes
to the header jack that we're going to
use for programming this is the jack
that you plug your AVR ISP programmer
into to program the device so as I
continue to wire I'm going to hook up
the SPI bus from that programming header
to both of the chips the SPI bus or a
serial peripheral entertained or
interface sometimes called is how the
chips are actually programs
here's how the programming header was
wired you see on the schematic that
depends go to the three programming pins
on the 80 mega which is 17 to 19 we've
got that hooked up here these jumpers
then the 80 tiny we're using pins 5
through 7 here and you can see those
have been connected to the programming
header as well the programming header
also needs positive 5 volts that's as a
reference ground and the reset line so a
reset button it's also hooked up the
burger main header that allows the
programming header to reset the
processor and get it ready for
programming now here's the power portion
of it we have a DC jack coming in
capacitor to smooth it out on and off
switch an LED indicator and then the
power goes to both of the
microcontrollers and the ground was the
ground so just hook it up here click it
on and test the power make sure the
power is going we need to go yep 5 volts
there and then in this one it's GZ 4 5 6
7 yep
so that's pretty much all the wiring I'm
going to label these pins and now we can
move on to the actual programming part
of this
pitching your big idea to senior
management easier said than done
researching designing and prototyping
your big idea using the node on element
14 yup much easier discover how we're
listening to your feedback and building
a better experience now it's time to
program here are the parts we need it's
a power cable to plug into our board
even though this header has a power
connection on it you can't actually
power this board through the programmer
you need its own power supply then of
course we plug in our programmer right
here then we plug the programmer into
the computer via the USB port the first
chip we're going to program is an eighty
tiny 45 it's a small 8 pin AVR
microcontroller let's turn on the power
light turns green ok this is AVR studio
6 you can download this development
environment for free from the App Mail
website we go up to tools and device
programming then we wait a few years for
it to load up ok we select our tool we
want the AVR is B mark 2 device we have
to set to 80 tiny 45 there it is
interface is P that's correct we hit
apply and see if we get anything ok that
works so we hit read the device
signature alright so we got a result
there which means that we are connected
to it properly let's see as is P clock
we just leave that as is the is P clock
does it actually sets the speed at which
it gets programmed rather than the speed
at which it runs you always want the
clock to be slower then it's Drive speed
so you don't break the chip basically so
you can always program in it at slowest
speed and at least get in there and
change stuff so now that we know that
it's connected let's write a little
sample code to test out our 80 tiny
so I'm just going to hook up this led to
PB 0 of the 80 tiny so eighty tiny has a
voltage ground and it has six i/o
although one of them is also used for
the reset line so I typically leave that
one alone because if you try to use it
as a digital i/o we will need a high
voltage programmer so basically we have
pv 0 PB 1 PB 2 3 & 4 & 3 & 4 also can be
used as analog digital converters the
first 3 pins here are also your 0 clock
master in slave out master out slave in
for your programming so when you program
the 80 tiny you don't want to have
things like LED connected to it just so
it won't interfere with your programming
I mean it doesn't always interfere but
it might
alright so in AVR studio we go to new
project make a location for it and we
select a GC cc executable project okay
alright now we select our device she's
going to be the AG tiny specifically the
oh come on don't do that we select our
device which is going to be the 80 tiny
45 here we have our pin Direction data
Direction port B I'm oaring a1 into the
zero position which makes it an output
so now we need to do this port B or
equals a same thing one shifted 0 to the
left then we do a delay delay
microseconds the nice thing about
something like you know AVR studio is
it's based off once that thing Microsoft
has it's based on visual studio so all
the you know keyboard functions and
tricks that you have are all there I'm
including autocomplete now we're going
to do port B and equals the inverse of
that which will turn off the bit and
then another delay
all right now we're going to hit to f5
to debug and compile and that will also
send it to our chip that we previously
it connected there we go a blinking
light here's something else we should
look at I'm going to go to the device
programming again read the chip and go
down to fuses fuses are what sets
certain things on the chip so here we're
using the internal clock but by default
clock divided by eight design which
means our eight megahertz clock becomes
a 1 megahertz clock we want to use the
full speed of the internal clock we turn
off clock divided by 8 and hit program
so now we're running eight times faster
the full speed of the internal crystal
but now we have to change our program so
we have the timing right here up here
before delay we put define frequency CPU
8,000 you else basically we're saying
the frequency of the CPU is 8,000 that
way our program knows how to calculate
the delay function if we put that
definition after delay or didn't include
it it wouldn't know what speed it is and
therefore it would be the right rate so
if I program it now it knows what the
proper speed is and frequency and the
LED is back to flashing once per second
now that we've used this board to
program in eighty tiny
let's use it to clone an Arduino alright
so we we have an Arduino to give it
power and then we also plug in the
programming header that for these extra
headers are for on there as we know now
in AVR studio we go up here and we
change your device to 18 mega 32:8 hit
apply we read it okay there is our
device we're going to go to memories and
then we're going to do is we're going to
read the memory off of the Arduino so
I'll just put it on the desktop here
just call it argue me he'll DL for
bootloader okay now it's copying what's
on the Arduino and creating a hex file
you can actually set bits in your chip
to keep it from being copied to kind of
protect it so no one can take your code
obviously they don't bother doing that
with your do we know but in professional
applications they might actually do that
to prevent people from copying that's
basically a one-way street you can't
read anything on the chip ever again
okay now we're going to unplug this just
put this aside
move our 80 tiny yes I know a toothpick
is only the proper way to do this you'll
have that ah well I'm doing all sorts of
crap today
I put in 18 mega three to eight one
alright put our program around this here
power plugged in so I'm going to go into
AV our programming and read it okay I've
got an air old we need the crystal
without the crystal it won't work this
thing has an internal oscillator as well
but if it's fuses aren't set to use the
internal oscillator it needs an external
oscillator turn it back on okay we go
here we read it okay we have a device
signature which means we're good so we
do a couple things we go into memory and
we load up the Arduino VL file we just
got now we program that to this chip we
do this takes a couple seconds
oh it's done okay you have to do a few

댓글 0개

등록된 댓글이 없습니다.

Total 61건 1 페이지