Documente Academic
Documente Profesional
Documente Cultură
http://murlidharshenoy.wordpress.com/category/simple/
http://murlidharshenoy.wordpress.com/category/simple/
The arduino Firmware 6he arduino is an a#esome prototypin( plat5orm$*hurnin( out prototypes 5rom )deas is 4ery 5ast since all the hard#are and other 5unctions are pre y much abstracted out and only the ;pplication Lo(ic needs to be implemented$ 6he Airm#are per5orms the 5ollo#in( basic 5unctions$:andle the communication routines,*ontrol the LED bri(htness 5or each o5 the *olors RED,GREEE and BLHE and also be able to display the 4arious se7uences o5 colors o5 li(ht$ ) ha4e a ;rduino Duemilano4e that came #ith an ;tme(a12-P processor onboard$6he ;tme(a 12-P #ould ha4e been an o4er9ill 5or this pro?ect so i decided to replace it #ith an ;tme(a-L$6he me(ahas only 1 4"s , PO% channels and -C 4"s 12C o5 Pash pro(ram memory o5 the me(a12-$6o 4eri5y the Qrm#are ) set up a simple testbench #ith three LEDs one each o5 RED GREEE and BLHE LEDs plu((ed into a breadboard connected to the Di(ital pins .,10,11 o5 the arduino$6hese *orrespond to the PO% Pins on the atme(a-$ 6he *ommunications #ith the controller #as tested #ith the standard serial port (i4en by the A6D) inter5ace o5 the arduino$ Ince 6he test bench #as setup ) could mo4e on to ;ctually Oritin( the Airm#are$6he 'etup section consists o5 all the PO% pins bein( set as Iutput and the 'erial Port opened to *ommunicate at .,00 Baud$6he %ain #hile Loop has a Eon&bloc9in( delay section in #hich the Aunctions are updated at a Hser chan(eable delay$6he more the delay the more slo#ly the color transition ta9es place and 4iD$6his is necessary because i5 a delay is not present then the transitions #ould be so 5ast that it #ould appear as i5 the LEDs are blin9in($) ha4e EI6 used the de5ault delay 5unction o5 the arduino library because o5 it bloc9in( nature(:ereRs (h p!""###$en(scope$com"pic&eLample&codes"non& bloc9in(&code"3 a (ood article about Eon&bloc9in( code3$6he delay #ould bloc9 the processor by eLecutin( a number o5 instructions #ith a 9no#n eLecution time to (et the speciQed time delay and only then eLecute the neLt instruction$6his bloc9in( delay #ould cause problems #hen data arri4es at the serial port and the processor is busy eLecutin( the delay$:ence the data #ill be missed by the processor or #ill be processed only #hen the delay loop completes eLecution thus introducin( la(s bet#een the user (i4in( input and the suitable 5unction bein( eLecuted$Eon&bloc9in( Delay is hence used to pre4ent these problems and to pro4ide reliable communication$;nd Precisely 5or this reason ) ha4e a4oided Bloc9in( codes in my Airm#are$ The CellPhone GUI 6he *ellphone GH) is a py',0 script #ith Q4e consecuti4e dialo( boLes 5or mode selection,red 4alue,(reen 4alue,blue 4alue and the update delay 4alue respecti4ely$6he mode selection selects one o5 three modes$%ode 0 is the de5ault mode #ill Qre up i5 no bluetooth de4ice is connected 5or control $)n this mode the entire colour spectrum is tra4ersed startin( 5rom red end o5 the spectrum$6he transition (oes on in a inQnte loop$%ode 2 is a mode #here each color namely Red,Green,Blue and Ohite Respecti4ely SbreatheT i$e$ the intensity o5 each color (oes 5rom Dero to maLimum and bac9 to Dero$*hec9 out the 8ideo to see it in action$6he %ode three is the *olor *hooser %ode$ )n this mode the Hser can choose the color$'et the 4alue o5 the respecti4e color 5rom 0 5or completely oU to 255 5or 5ully bri(ht$ ;lso the Hpdate delay can be set in milliseconds$6his is used 5or se in( the Delay Bet#een Each color transition$the more the dealy the more slo#er #ill be the colour chan(e$ ;n update delay o5 around 5 to 20 milliseconds has a pleasin( eUect$ V'creenshotW6he Pys,0 'cript Runnin( on my ',0 1rd Edition Eo9ia E+-$
2 of 14
24-12-2013 11:28
http://murlidharshenoy.wordpress.com/category/simple/
(h p!""murlidharshenoy$Qles$#ordpress$com"2011"12"screenshot0005$?p(3 The PC GUI. 6he P* (ui #as created Hsin( PyG6C (###$py(t9$or("3 and H)mana(er (###$py(t9$or("py(t92tutorial"sec&H)%ana(er$html3 6ools 5or GH) *reation$ 6he P* GH) runs #ell on Oindo#s (and probably also on LinuL3$) ha4e tested it on my Oindo#s 'e4en :ome Premium ,2&bit laptop $Aor Runnin( the ;pplication on LinuL 'mall ;mount o5 chan(es #ill ha4e to be made ,Li9e chan(in( the serial port label(on linuL the PIR6 4ariable #ould be somethin( li9e de4" yH'B03 etc$ But other than that it #ould #or9 Qne on linuL too$6he GH) has three sliders 5or *olor selection and a Bunch o5 radio Bu ons 5or %ode selection$6he 'liders are acti4e only in the color selection mode$*hec9 out the 'ource code included in the Kip Qle a ached V'creenshotW6he Python Gui runnin( on ; #in+ :ome Premium L,2 %achine
(h p!""murlidharshenoy$Qles$#ordpress$com"2011"12"pc&(ui$?p(3 Hardware Design the :ard#are basically consists o5 a ;tme(a-L %icrocontroller (#ith an ;rduino Bootloader
3 of 14 24-12-2013 11:28
http://murlidharshenoy.wordpress.com/category/simple/
on&board #hich i ha4e included in the sources$Dip Qle3 and three )RA,20 E&channel %I'AE6s ,Ine Each 5or Dri4in( Each *olor on the RGB LED strip $6hereRs also Lm111+ 1$18 po#er re(ulator 5or po#erin( up the Lo(ic and a Ber( connector 5or connectin( the RJ,6J,GED and 8** lines o5 the Bluetooth %odule #ith the ;tme(a$) did Eot ma9e a schematic since i did not #ant to etch a P*B$)nstead i ?ust built the entire circuit on a per5&board and used PeLible #ire to build the circuit$6he Entire *ircuit is desi(ned to be po#ered by an 128 D* 'upply$) chec9ed the Po#er *onsumption o5 the entire circuit #ith a %ultimeter and it #as 5ound to be around 1;mp$) used a 124 2 ;mp '%P' based supply$
4 of 14
24-12-2013 11:28
http://murlidharshenoy.wordpress.com/category/simple/
(h p!""murlidharshenoy$Qles$#ordpress$com"2011"12"im(0021,$?p(3 Oor9in( on a P*B usin( toner tran5er techni7ue to Qnalise the prototype$ ;ll the Python 'ource *odes and the :ard#are schematics and the Layout Dia(rams in Ea(le Aormat are included in the a ached Kip Aile $Aeedbac9 is appreciatedM(Eote!a HLE2-01 and a +-05 are some eLtra components on the P*B sho#n abo4e that i tried out durin( testin($But are not necessary in this circuit3$ :ere are some pics o5 the pro?ect
5 of 14
24-12-2013 11:28
http://murlidharshenoy.wordpress.com/category/simple/
(h p!""murlidharshenoy$Qles$#ordpress$com"2011"12"im(00221$?p(3
(h p!""murlidharshenoy$Qles$#ordpress$com"2011"12"im(00220$?p(3in action$
(h p!""murlidharshenoy$Qles$#ordpress$com"2011"12"im(0021-$?p(3
6 of 14
24-12-2013 11:28
http://murlidharshenoy.wordpress.com/category/simple/
(h p!""murlidharshenoy$Qles$#ordpress$com"2011"12"im(0021.$?p(3 Do#nload all the re7uired 'ource codes and the hard#are desi(n Qles 5rom here (h p!""###$2shared$com"Dip"CFt:@;yB"'ources$html3$ HPD;6E! Hploaded all the source *ode to (ithub (h ps!""(ithub$com"hmms"bluetooth&led&control3 Posted in arduino, aubtm&20, Bluetooth, Di#ali Pro?ects, simple, Hncate(oriDed Y 6a((ed Di#ali Pro?ect, LED Y . *omments
http://murlidharshenoy.wordpress.com/category/simple/
) added a relimate connector to ma9e it easy to connect it a breadboard or to connect ?umper #ires$) had the 5ollo#in( connections on the module ta9en to the connectorGED,8** and the RJ and 6J connections o5 the serial port$
(h p!""murlidharshenoy$Qles$#ordpress$com"2011"10"bluetooth0module$?p(3 Fust po#er up the Bluetooth module() Aed in po#er to the Bluetooth %odule 5rom the 1$14 output o5 my arduino 3 and scan the bluetooth de4ices on your P*"laptop$)5 e4erythin(Rs done correctly you #ill be able to Qnd a bluetooth de4ice named ;HB6%&20 or somethin( simliar$Gou #ill be as9ed 5or a pairin( code in case o5 the abo4e model (;HB6%&203it is ---- but it mi(ht be diUerent i5 you are usin( a bluetooth module 5rom another 4endor$In my O)EDIO' + Laptop it sho#ed up as
8 of 14
24-12-2013 11:28
http://murlidharshenoy.wordpress.com/category/simple/
(h p!""murlidharshenoy$Qles$#ordpress$com"2011"10"de4ices0printers$pn(3 Ri(ht *lic9 on the de4ice name in the de4ices and printers 5older under the hard#are tab $Gou #ill Qnd a 'tandard 'erial o4er Bluetooth Lin9 and the *I% port number #riteen in brac9ets$ Eote do#n the *I% port number$6his completes the Basic test$ Step Two! 8eri5y 6he *I% lin9$ you #ill need to 4eri5y i5 you are able to send and recei4e data o4er the serial port to be able to use the de4ice in your pro?ect 5or that$ ) used the A6212RL H'B to serial con4erter chip on&board the arduino$ But remember to remo4e the ;6me(a processor chip 5rom the soc9et$(GouRre out o5 luc9 i5 you ha4e one o5 those '%D 4ersions o5 the arduino $)n this case you #ill need to (et hold o5 a 1$18 po#er source such as the lm111+&1$1 and a A6212RL brea9out board 5rom here (h p!""###$spar95un$com"products"+1-3 or here (h p!""###$bhasha$co$cc "product$php<id0product=213 3 be5ore you connect the bluetooth module to the arduino$ Eo# *onnect the RJ line o5 the Bluetooth module to the 6J line o5 the A6212RL module or you arduino D)(ital Pin 1 and the 6J line to the RJ line o5 the module or to that o5 the arduino$ Eo# open a terminal application such as 6era6erm (Gou can do#nload it 5rom here (h p!""en$source5or(e$?p"pro?ects" ssh2"releases"33 select the serial port on #hich you connect your arduino"A6212 module(you can (et the com port number o5 the A6D) de4ice in the de4ice mana(er under *I% ports &] H'B serial Port3$Ipen a terminal #ith the *I% port number o5 the 6he A6D) de4ice and set the baud rate to .,00 ,-bit &data,Parity& none,1 &stop bit,Alo# control &Eone$ Eo# open another *I% port,this time #ith the 5or the serial *I% port o5 your bluetooth de4ice that you had noted do#n in the Qrst step$ 6he se in(s o5 this *I% port #ill also be the same as abo4e A6D) de4ice$ )A all the connections are proper and the lin9 is established then anythin( you type in the A6D) *I% terminal should appear on the Bluetooth *I% terminal and 4ice&4ersa
9 of 14
24-12-2013 11:28
http://murlidharshenoy.wordpress.com/category/simple/
(h p!""murlidharshenoy$Qles$#ordpress$com"2011"10"teramterm$pn(3 6he N*IE!1 is somethin( that the Bluetooth module (i4es out on the *I% port #hene4er a de4ice is connected $6his Pro4es that the de4ice can success5ully communicate o4er the serial port Step Three! Ainally connectin( the Bluetooth module to the %icro&controller$ :ereRs a 7uic9 arduino script to 4eri5y e4erythin(Rs Qne $ void setup() { Serial.begin(9600); } // open the serial port at 9600 bps:
void loop() { if( byte( Serial.read() !a! )) { Serial.print("#n$ey%"); // print $ey } } Fust open the arduino )DE and open the serial terminal$'et the *I% port number that you noted do#n in the Airst 'tep and the baud rate to .,00$ Fust type an SaT #ithout the 7uotes in the terminal and you should (et a reply #ith a [:eyMR$; #ord o5 caution the Bluetooth module #or9s at the *%I' 4olta(e ran(e o5 1$18 and can ta9e only upto 1$+4 maL so #hile inter5acin( #ith 66L le4el de4ices such as the ;6me(a-"1,-"12- o5 the arduino le4el con4ersion #ill be re7uired (chec9 out this (h p!""###$nLp$com"documents"application0note";E10221$pd53 app note 5rom EJP3$) chose to use the 1$14 Le4el ;tme(a-L instead since the de4ice can #or9 at 1$18 no le4el con4ersion #ould be re7uired$6his is the Qnal de4ice that i made uses the L%111+&1$1 as the po#er re(ulator to re(ulate the 124 5rom the #all #art$ Aor microcontrollers such as LP*1+,- and LP*212- #hich run at 1$14 le4els no le4el con4ersion or modiQcation #ould be re7uired at all$;ll that #ould be needed to be done is to connect the rL,tL and the (round lines o5 the %icrocontroller to the Bluetooth module and you #ould ha4e a Bluetooth enabled microcontroller pro?ectM
10 of 14
24-12-2013 11:28
http://murlidharshenoy.wordpress.com/category/simple/
(h p!""murlidharshenoy$Qles$#ordpress$com"2011"10"board0top$?p(3
(h p!""murlidharshenoy$Qles$#ordpress$com"2011"10"board0bo om$?p(3 (h p!""murlidharshenoy$Qles$#ordpress$com"2011"10"board0top$?p(36he board #as Qrst desi(ned #ith the ;tme(a- then i added the 1$14 re(ulator and s#itched o4er to the ;tme(a-L$6he %os5ets and other de4ices onboard are 5or another pro?ect that iRm currently #or9in( on$Oill Post about the pro?ect in my neLt post$Post in the *omments belo# #hat you thin9 about it M
11 of 14
24-12-2013 11:28
http://murlidharshenoy.wordpress.com/category/simple/
(h p!""murlidharshenoy$Qles$#ordpress$com"2011"10"2,10201121.$?p(3 Posted in arduino, aubtm&20, Bluetooth, simple Y 6a((ed arduino Y 10+ *omments
(h p!""murlidharshenoy$Qles$#ordpress$com"200."0+
12 of 14 24-12-2013 11:28
http://murlidharshenoy.wordpress.com/category/simple/
"050+200.225$?p(3
;ll said and done i decided to ma9e my o#n 1#a led lamp$ )Rm usin( a 1# LED #ith nothin( but a ,E printed on it as you can see(i thin9 this mi(ht be some cheap chinese made replica o5 the philips lumileds luLeon )3$ ;n lm11+ ad?ustable 4olata(e re(ulator and a 1$. ohm 1 #a resistor$ ; heatsin9 i sal4a(ed 5rom an old 68 recei4er boL$)Rm usin( a no9ia mobile char(er model ;*P&12E has a rated output o5 5$+4_-00ma$But my multiimeter (a4e me an output o5 +4MM maybe because it #as the open circuit 4olta(e$
) chose the lm11+ because it has a constant current mode (see the application notes (h p!""###$national$com"mp5"L%"L%11+$html33 and also its damn cheap$6he lm11+ can handle currents upto 1$5; $) su((est a achin( a heatsin9 to the Lm11+ as #ell as theLED$ ;ltou(h the L%11+ has thermal protection buit in the led may heat up and an o4erheated LED is as (ood as dead $6he L%11+ re(ulator (i4es out a constant 4olta(e o5 1,25 4olts bet#een ;DF and 8out, so by addin( a resistor bet#een these t#o outputs, youRll (et a constant current$to Qnd the resistance 4alue use ohms la# 8=)R$:ere the 8=1$254 and re7uired ) is $150; hence #e (et R as 1$5+12ohms$ the nearest standard 4alue is 1$1ohm $But #e #ill use the 1$.ohm as a sa5e measure$ 6he constant current source has a 4olta(e drop o5 1 4$ ;nd since the 4olta(e drop across the LED is 1$2 4 #e #ould re7uire around ,4 as 4cc$;4oid usin( hi(her 4olat(e po#er supplies than re7uired since eLcess 4olta(e is #asted as heat$ ) su((est usin( a supply o5 , to . 4olt$;lso the #a a(e o5 the resistors may be hi(h enou(h to handle the heat (enerated$ 6he Qnished product is sho#n belo#$6his mi(ht not be the most e^cient #ay to po#er these 1# LEDs but itRs the simplest and the most cost eUecti4e$ 6he e^ciency may be increased by usin( the ri(ht supply 4olta(e to reduce the po#er #asta(e$
(h p!""murlidharshenoy$Qles$#ordpress$com"200."0+ "050+200.211$?p(3
13 of 14
24-12-2013 11:28
http://murlidharshenoy.wordpress.com/category/simple/
(h p!""murlidharshenoy$Qles$#ordpress$com"200."0+
"050+200.22.$?p(3 Posted in po#er LED, simple Y 2 *omments Blo( at OordPress$com$ Y 6he Rusty Grun(e 6heme$ Aollo#
14 of 14
24-12-2013 11:28