ARDUINO
THE ARDUINO BOOK PROGRAMS; THE LATEST GUIDE TO SIMPLY PROGRAM ARDUINO
------------------------------------------------------
Copyright 2019. All Rights Reserved.
No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, or by any information storage and retrieval system without the prior written permission of the publisher, except in the case of very brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law.
DISCLAIMER
Th nfrmtn ntnd wthn th Bk strictly fr educational purposes. If u wh to l d contained n th Bk, u are tkng full responsibility fr your tn.
The author h md every ffrt t nur th accuracy f th nfrmtn wthn this bk w rrt t tm f ubltn. Th author d not um nd hereby dlm any lblt t n rt fr n loss, damage, r disruption ud b errors r mn, whthr uh rrr r omissions result frm dnt, nglgn, or n thr cause.
ABOUT THIS BOOK
In th bk I am going to explain th b lmnt of Arduino brd. W are gng to answer th following questions: wht is Arduino? Hw dd th rjt start? What d t mk Arduino dffrnt?
If u wrk wth prototyping boards, u have t m r Ardun. Ardun a h prototyping brd designed for ntrllng objects nd ntrtv tm. It uull t u $30 t $50 t obtain n. Th brd uses n Atml mrntrllr with additional electronic mnnt t maintain th availability nd durblt f the computing unt. Fr ntn, Vltg Regulator. The board uull rur 5 vlt t operate. Th vltg rgultr rgult the nut vltg nd allows providing frm 5 t 12 volt. Th brd is n source nd all dgrm r published under rtv mmn ln.
On f th mt mrtnt t f Ardun tht it is standard nntvt. Th brd usually h 16 t 48 I/O n. Sm f thm r digital. Othr r dgnd for nlg nut voltage murmnt. Furthrmr, m f th dgtl I/O n gnrt ul-wdth modulation ngl - l knwn as PWM.
Th Ardunio not nl hrdwr n source. It software t. Ardun h a fr n source ntgrtd dvlmnt environment (IDE). Th IDE llw u wrt and upload ur ltn to Arduino board. Th rgrmmng lngug of Ardun is bd ll n 'Processing' rgrmmng language. With a few lk and ul line f d, u will be able to uld ur application t th brd.
Th Arduino has a vbrnt mmunt. Yu hv lnt of people t ask and thousands f thousands f websites t search. In ddtn, the team h dumntd th Ardun rftl. Everything wll xlnd nd mrhnv. Accessing th rurd data rltvl frm thr ffl wbt.
Th rjt trtd n Italy by tw students. The d w t buld a h mrntrllr t ntrl ntrtv ltrn bjt. B M 2011, mr than 300,000 Ardun boards hv bn ld. Rd mr n th htr f th bk.
Table of Contents
INTRODUCTION
We ll are familiar wth the wrd "Rbt." At lt n th g, hldrn knw wht a rbt . Nt only tht, toys f td' hldrn r l a rbt. A rbt a mechanical system, which a synthetic funtn. Th wrd rbt came from th Czh wrd "Robota" whh mn "forced labor". This mhn now ung l a mlmntr n.
Nw th utn , wht th relation f a rbt wth Ardun? Dd the question r?
Arduino a mutr ftwr nd hardware company r mmunt tht dgn nd manufactures microcontroller nd mrntrllr kits fr rbt wll as thr digital dv.
Th name "Arduino" came frm the nm f a bar of Ivr, Italy, whr m f th fundr of th project ud to mt. Nowadays this t th mt favorite tl f mdrn roboticists. Bfr trtng with n Ardun mrntrllr, one should know th vrt of the Ardun. Sm ntr lvl Ardun are:
UNO
LEONARDO
ROBOT
ESPLORA
MICRO
NANO
MINI
MKR2UNO ADAPTER
STARTER KIT
BASIC KIT
LCD SCREEN
Th Ardun are t u nd rd t power n' first rbt. These brd r the bt t start lrnng nd t d ur bt thrugh th mrntrllr.
Th were but th hardware. Now let's m to th Ardun software. Eh of th brd rgrmmbl wth th Arduino IDE. Th a r-ltfrm ltn written n th rgrmmng lngug, Jv. C and C++ are l supported n th IDE wth l rul. A program wrttn n Ardun IDE is lld a kth. These sketches r vd th text files with th fl xtnn .ino and .pde. A mnml Ardun kth consists f tw funtn. They r: tu(), l().
Now I will tell you but the most ntrtng Ardun, tht Ardun ROBOT.
Ardun ROBOT th first Ardun n wheels. It nt f tw brd nd h of th brd h a microcontroller. Tht mn n ROBOT, thr r a total f two mrntrllr. One of thm the mtr brd, which controls th motors and th thr one th ntrl brd, which ntrl the nr and dd the rtn. It l rgrmmbl wth Ardun IDE. Both th microcontroller boards are bd n ATmg32u4 whh is a low-power CMOS 8-bt microcontroller based n the AVR nhnd RISC rhttur. The ROBOT mlr t th LEONARDO.
CHAPTER 1
THE DUE AND YUN
Two of th nwr Arduino boards that are vlbl r th Due and th YUN. Lt' trt by dung th Du. The Due th first Ardun that u a 32-bt ARM rr. Mt Ardun have 8-bt AVR rr. Th Ardun Due runs t 84 MHz, whereas mt Arduinos t dt run t 16 MHz, l th Due h more mmr, with 512 kB of flash mmr. On drwbk of th Ardun Du is tht t operates t 3.3 V ntd of 5 V. Th n and of tlf nt bd thng, it's actually good thing fr various rn, it's just tht mn f th existing Arduino hld and r will be nmtbl wth th Arduino Due bu f this. The Ardun Due l h ut a few thr capabilities that th thr Arduinos d not. On is tht t contains 12 bt nlg to dgtl conversion, th gv your nlg nut 4096 dffrnt bl vlu, whr most f th xtng Arduinos nl rvd fr 1024 nut levels. Anthr ftur unu t th Ardun Du a pair f dgtl t nlg nvrn outputs (DAC1 and DAC2), t the only Ardun t date that has nlg utut. Th mn tht Arduino projects whh rur sound r a bt r t accomplish, but the nlg utut r uful for mn thng. Th dgtl t analog nvrn outputs l hv 12 bt of rlutn. Th Ardun Du has bttr ntrrut blt, ll of th Arduinos t dt only urt ntrrut on rtn n, hwvr th Due wll llw u to tth n ntrrut n any digital nut pin. Wth 54 nut n, this represents a lt f flxblt. A you n th Ardun du ut a bl little dv.
Th nwt member f the Arduino family is th Ardun Yun, nd th Yun ut a bt dffrnt from any thr Ardun to dt. It l built rund a 32-bt processor lk th Du. It operates at 5 V lk mt thr Arduinos, xt fr th Du, nd h a footprint tht is vr mlr t th Arduino Lnrd. It has 20 dgtl I/O n, vn PWM channels, and 12 analog nut hnnl. Th bggt dffrn wth the Yun is that it l contains an Athr processor whh can run a utm version of Lnux named Ln. Th Yun l h Ethernet nd Wi-Fi urt, and a mrSD nntn. I mntnd how th Ardun Due has mr blt fr sound ltn thn most f the thr Ardun, wll th Ardun Yun tk that t n vn hghr level. The Yun wll also b xllnt for dt logging rjt, vn thugh thr r thr Ardun wth tht capability.
CHAPTER 2
LOW POWER ARDUINO
A common Arduino, fr instance th Mn d nt consume vr muh power, tll 40 MA when nntd t a USB cable. If u'r going to b wrng ur Ardun n something other thn batteries, the wr rurmnt nrmll n't a concern, it wll be jut too lttl to make any dffrn. Once u trt mthng lk a remote mntrng ltn whr you are required t run with bttr wr, power numtn n bm gnfnt. In my working xrn hng to lult the amount f tm an Arduino wll ntnu wth a battery k is ut tugh du to th ft that thr are so mn factors involved, frt f all there r a lt f t, lkln, Nickel Mtl Hdrd, lithium-ion, rechargeable, nn-rhrgbl. Evn for a rtn knd f bttr trl A, thr wll b wdl varying trg capacities depending n th tl of bttr it ( Nkl Mtl Hydride r lthum-n) nd there lkl variability mng the dffrnt brnd (usually you get wht u pay for). Whn your bttr gt dltd, th vltg uld drops, f u are using 4 trl A batteries, which ul x volts t rt n Ardun which requires t least 5V, th Ardun may vr well t wrkng whn th vltg uld d t lw, despite th ft that there tll a ubtntl untt of energy rmnng n th bttr.
I wn't b doing n specific lultn hr for th reason tht I find th figures r nt rtl. I must mntn tht bttr uull are fd n terms f Milli-ampere hours. S ntm ur Ardun hooked v USB, t funtnng t 5 vlt, f t is drwng forty Mll-m, that n't th same measure f wttg requiring frt Mll-mr frm a 9 V bttr. Moreover it dnd on wht ur ltn . Ar u jut taking nut frm m type f analog mntrng dv r are u using t n a servo, these hv drmtll dffrnt power nd, and once more in my xrn u'll fnd it nt useful t lult. I fnd th best way is get a hold of m bttr u have rund th house and see hw lng th last, thn u th measurements t mk empiric lultn.