Simple _ Murli's Blog

download Simple _ Murli's Blog

of 14

Transcript of Simple _ Murli's Blog

  • 8/13/2019 Simple _ Murli's Blog

    1/14

    Category Archives: simple

    Bluetooth Controlled RGB LED strip

    Posted on December 25, 2011 by murlidharshenoyRGB LED strips such as this (hp!""###$ebay$in"itm"5%&5050&RGB&LED&'trip&Liht&)R&Remote&*ontrol&Po#er&"1+02-+21./ht.#t..03 are a4ailable or a lo# price$6hey are enerally

    bundled #ith a )R controller and a po#er supply to po#er the LEDs and to chane the color ,display4arious colour se7uences etc$6he )R Recei4er is similiar to those used in 68 and re7uiresline&o&siht or reliable operation $ ) #anted the strip to be *ontrollable 4ia a P* or a %obilePhone$'o ) decided to ma9e my o#n RGB LED strip *ontroller and to enable #ireless control i usedBluetooth technoloy$6he de4ice can be controlled usin a P* or a mobile phone #ith Bluetoothha4in a suitable raphical user interace$

    6he :ard#are needed or this build is prey simple and uses commonly ound de4ices and may besal4aed rom old electronics$

    ;tmea- (hp!""###$oole$co$in"urlrct=?>7=atmea->source=#eb>cd=1>s7i=2>

    4ed=0**c@A?;;>url=hp;2A2A###$atmel$com2Aatmel2Aacrobat2Adoc2-$pd>ei=G1'6uP9Csui@6&-2B;>us=;A@?*:i7l&.pC*8+-BRFFn)6F6n823L&-PH -&bit ;8Rmicrocontroller

    1$

    L%111+ (hp!""###$oole$co$in"urlrct=?>7=lm111+>source=#eb>cd=2>s7i=2>

    4ed=0**9@A?;B>url=hp;2A2A###$national$com2Ads2AL%2AL%111+$pd>ei=@8'6tI6E)26i;a&r:+B;>us=;A@?*:R9HEI512#9Il567)tl:a@?oFy;3&$ $8 LDIreulator

    2$

    )RA0 (hp!""###$oole$co$in"urlrct=?>7=ir0>source=#eb>cd=2>s7i=2>

    4ed=0*DH@A?;B>url=hp;2A

    2A###$datasheetcatalo$or2Adatasheet2A'G'6homson%icroelectronics2AmJ7suu$pd>ei=K1'6se;[email protected];>us=;A@?*E9n2sRDoi0-tL&Ke+t9.D#3 &*hannel %I'AE6(sal4aed rom an old Hninterrupted Po#er 'upply&6han9sCushal or that Dead HP'M 3

    $

    *onnectin #ires ,Ber strips,etc$$

    124 1;NOall #art$5$

    6he Airm#are or the ;6mea-L micrcontroller #as de4eloped #ith ;rduino 002 and also #ith;rduino 1$0 (*an be do#nloaded or your I' o choice rom :ERE (hp!""###$arduino$cc"en"%ain"sot#are33$6he GH) or the Oindo#s P* #as De4eloped usin the G6CN tool9it usin the python

    bindins a4ailable 4ia pyG6C(Get it rom here (hp!""###$oole$co$in"urlrct=?>7=pyt9>source=#eb>cd=2>4ed=0**o@?B;#;@>url=hp;2A2A###$pyt9$or2Ado#nloads$html>ei=1lO6snL)eIci;1u2B@>us=;A@?*Al#:LBpyp'E&y6mi%aH6L*+-#;#33$6he GH) #as desined or runnin on no9ias0 de4ices usin py'0 (hp!""sourceore$net"pro?ects"pys0"3$

    ple | Murli's Blog http://murlidharshenoy.wordpress.com/category/simple/

    14 24-12-2013 11:28

  • 8/13/2019 Simple _ Murli's Blog

    2/14

    The arduino Firmware

    6he arduino is an a#esome prototypin platorm$*hurnin out prototypes rom )deas is 4ery astsince all the hard#are and other unctions are prey much abstracted out and only the ;pplicationLoic needs to be implemented$

    6he Airm#are perorms the ollo#in basic unctions$:andle the communication routines,*ontrolthe LED brihtness or each o the *olors RED,GREE and BLHE and also be able to display the

    4arious se7uences o colors o liht$

    ) ha4e a ;rduino Duemilano4e that came #ith an ;tmea2-P processor onboard$6he ;tmea 2-P#ould ha4e been an o4er9ill or this pro?ect so i decided to replace it #ith an ;tmea-L$6he mea-has only 4"s PO% channels and -C 4"s 2C o ash proram memory o the mea2-$6o 4eriythe Qrm#are ) set up a simple testbench #ith three LEDs one each o RED GREE and BLHE LEDsplued into a breadboard connected to the Diital pins .,10,11 o the arduino$6hese *orrespond tothe PO% Pins on the atmea-$ 6he *ommunications #ith the controller #as tested #ith the standardserial port i4en by the A6D) interace o the arduino$

    Ince 6he test bench #as setup ) could mo4e on to ;ctually Oritin the Airm#are$6he 'etup sectionconsists o all the PO% pins bein set as Iutput and the 'erial Port opened to *ommunicate at .00Baud$6he %ain #hile Loop has a on&bloc9in delay section in #hich the Aunctions are updated at aHser chaneable delay$6he more the delay the more slo#ly the color transition ta9es place and4i$6his is necessary because i a delay is not present then the transitions #ould be so ast that it#ould appear as i the LEDs are blin9in$) ha4e I6 used the deault delay unction o the arduinolibrary because o it bloc9in nature(:eres (hp!""###$enscope$com"pic&eample&codes"non&

    bloc9in&code"3 a ood article about on&bloc9in code3$6he delay #ould bloc9 the processor byeecutin a number o instructions #ith a 9no#n eecution time to et the speciQed time delay andonly then eecute the net instruction$6his bloc9in delay #ould cause problems #hen data arri4es

    at the serial port and the processor is busy eecutin the delay$:ence the data #ill be missed by theprocessor or #ill be processed only #hen the delay loop completes eecution thus introducin las

    bet#een the user i4in input and the suitable unction bein eecuted$on&bloc9in Delay is henceused to pre4ent these problems and to pro4ide reliable communication$;nd Precisely or 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 boes or mode selection,red4alue,reen 4alue,blue 4alue and the update delay 4alue respecti4ely$6he mode selection selects one

    o three modes$%ode 0 is the deault mode #ill Qre up i no bluetooth de4ice is connected or control$)n this mode the entire colour spectrum is tra4ersed startin rom red end o the spectrum$6hetransition oes on in a inQnte loop$%ode 2 is a mode #here each color namely Red,Green,Blue andOhite Respecti4ely SbreatheT i$e$ the intensity o each color oes rom ero to maimum and bac9 toero$*hec9 out the 8ideo to see it in action$6he %ode three is the *olor *hooser %ode$ )n this modethe Hser can choose the color$'et the 4alue o the respecti4e color rom 0 or completely oU to 255 orully briht$

    ;lso the Hpdate delay can be set in milliseconds$6his is used or sein the Delay Bet#een Eachcolor transition$the more the dealy the more slo#er #ill be the colour chane$ ;n update delay oaround 5 to 20 milliseconds has a pleasin eUect$

    V'creenshotW6he Pys0 'cript Runnin on my '0 rd Edition o9ia +-$

    ple | Murli's Blog http://murlidharshenoy.wordpress.com/category/simple/

    14 24-12-2013 11:28

  • 8/13/2019 Simple _ Murli's Blog

    3/14

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"12"screenshot0005$?p3

    The PC GUI.

    6he P* ui #as created Hsin PyG6C (###$pyt9$or"3 and H)manaer(###$pyt9$or"pyt92tutorial"sec&H)%anaer$html3 6ools or GH) *reation$ 6he P* GH) runs #ellon Oindo#s (and probably also on Linu3$) ha4e tested it on my Oindo#s 'e4en :ome Premium&bit laptop $Aor Runnin the ;pplication on Linu 'mall ;mount o chanes #ill ha4e to be made

    ,Li9e chanin the serial port label(on linu the PIR6 4ariable #ould be somethin li9ede4"yH'B03 etc$ But other than that it #ould #or9 Qne on linu too$6he GH) has three sliders or*olor selection and a Bunch o radio Buons or %ode selection$6he 'liders are acti4e only in thecolor selection mode$*hec9 out the 'ource code included in the Kip Qle aached

    V'creenshotW6he Python Gui runnin on ; #in+ :ome Premium %achine

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"12"pc&ui$?p3

    Hardware Design

    the :ard#are basically consists o a ;tmea-L %icrocontroller (#ith an ;rduino Bootloader

    ple | Murli's Blog http://murlidharshenoy.wordpress.com/category/simple/

    14 24-12-2013 11:28

  • 8/13/2019 Simple _ Murli's Blog

    4/14

    on&board #hich i ha4e included in the sources$ip Qle3 and three )RA0 &channel %I'AE6s ,IneEach or Dri4in Each *olor on the RGB LED strip $6heres also Lm111+ $8 po#er reulator orpo#erin up the Loic and a Ber connector or connectin the RJ,6J,GD and 8** lines o theBluetooth %odule #ith the ;tmea$) did ot ma9e a schematic since i did not #ant to etch aP*B$)nstead i ?ust built the entire circuit on a per&board and used eible #ire to build thecircuit$6he Entire *ircuit is desined to be po#ered by an 128 D* 'upply$) chec9ed the Po#er*onsumption o the entire circuit #ith a %ultimeter and it #as ound to be around 1;mp$) used a

    124 2 ;mp '%P' based supply$

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"12"rbledcontroller$?p3

    ) made %y prototype on a perXoard heres a Pic o the 6op 'ide$

    ple | Murli's Blog http://murlidharshenoy.wordpress.com/category/simple/

    14 24-12-2013 11:28

  • 8/13/2019 Simple _ Murli's Blog

    5/14

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"12"im0251$?p3

    ;nd the Boom 'ide

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"12"im02$?p3

    Oor9in on a P*B usin toner traner techni7ue to Qnalise the prototype$ ;ll the Python 'ource*odes and the :ard#are schematics and the Layout Diarams in Eale Aormat are included in theaached Kip Aile $Aeedbac9 is appreciatedM(ote!a HL2-0 and a +-05 are some etra componentson the P*B sho#n abo4e that i tried out durin testin$But are not necessary in this circuit3$

    :ere are some pics o the pro?ect

    ple | Murli's Blog http://murlidharshenoy.wordpress.com/category/simple/

    14 24-12-2013 11:28

  • 8/13/2019 Simple _ Murli's Blog

    6/14

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"12"im02$?p3

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"12"im020$?p3in action$

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"12"im02-$?p3

    ple | Murli's Blog http://murlidharshenoy.wordpress.com/category/simple/

    14 24-12-2013 11:28

  • 8/13/2019 Simple _ Murli's Blog

    7/14

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"12"im02.$?p3

    Do#nload all the re7uired 'ource codes and the hard#are desin Qles rom here(hp!""###$shared$com"ip"CFt:@;yB"'ources$html3$

    HPD;6E! Hploaded all the source *ode to ithub (hps!""ithub$com"hmms"bluetooth&led&control3

    Posted in arduino, aubtm&20, Bluetooth, Di#ali Pro?ects, simple, Hncateoried Y 6aed Di#aliPro?ect, LED Y . *omments

    Adding Bluetooth To your Microcontroller projects

    Posted on Ictober 2, 2011 by murlidharshenoyBluetooth has become Hbi7utios these days Bluetooth Oireless technoloy is present is %ost mobilephones today as #ell as in laptops and in des9top P*s$;nd ) your P* or laptop doesnt ha4e it thenyou can et a Bluetooth H'B donle or cheap(li9e 2&Z 3M

    Oouldnt it be interestin i your mobile phones "P*s could tal9 to your %icro&controller Pro?ects

  • 8/13/2019 Simple _ Murli's Blog

    8/14

    ) added a relimate connector to ma9e it easy to connect it a breadboard or to connect ?umper #ires$)had the ollo#in connections on the module ta9en to the connectorGD,8** and the RJ and 6Jconnections o the serial port$

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"10"bluetoothmodule$pn3

    Step one! 6est the module

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"10"bluetoothmodule$?p3

    Fust po#er up the Bluetooth module() Aed in po#er to the Bluetooth %odule rom the $4 output omy arduino 3 and scan the bluetooth de4ices on your P*"laptop$) e4erythins done correctly you#ill be able to Qnd a bluetooth de4ice named ;HB6%&20 or somethin simliar$ou #ill be as9ed ora pairin code in case o the abo4e model (;HB6%&203it is ---- but it miht be diUerent i you areusin a bluetooth module rom another 4endor$In my O)DIO' + Laptop it sho#ed up as

    ple | Murli's Blog http://murlidharshenoy.wordpress.com/category/simple/

    14 24-12-2013 11:28

  • 8/13/2019 Simple _ Murli's Blog

    9/14

    S;HB6%&20\ under de4ices and printers$

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"10"de4icesprinters$pn3

    Riht *lic9 on the de4ice name in the de4ices and printers older under the hard#are tab $ou #illQnd a 'tandard 'erial o4er Bluetooth Lin9 and the *I% port number #riteen in brac9ets$ otedo#n the *I% port number$6his completes the Basic test$

    Step Two! 8eriy 6he *I% lin9$

    you #ill need to 4eriy i you are able to send and recei4e data o4er the serial port to be able to usethe de4ice in your pro?ect or that$ ) used the A622RL H'B to serial con4erter chip on&board thearduino$ But remember to remo4e the ;6mea processor chip rom the soc9et$(oure out o luc9 i

    you ha4e one o those '%D 4ersions o the arduino $)n this case you #ill need to et hold o a $8po#er source such as the lm111+&$ and a A622RL brea9out board rom here(hp!""###$spar9un$com"products"+1-3 or here (hp!""###$bhasha$co$cc"product$php

  • 8/13/2019 Simple _ Murli's Blog

    10/14

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"10"teramterm$pn3

    6he N*I!1 is somethin that the Bluetooth module i4es out on the *I% port #hene4er a de4ice isconnected $6his Pro4es that the de4ice can successully communicate o4er the serial port

    Step Three! Ainally connectin the Bluetooth module to the %icro&controller$

    :eres a 7uic9 arduino script to 4eriy e4erythins 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 terminaland you should et a reply #ith a [:eyM$; #ord o caution the Bluetooth module #or9s at the*%I' 4oltae rane o $8 and can ta9e only upto $+4 ma so #hile interacin #ith 66L le4elde4ices such as the ;6mea-"1-"2- o the arduino le4el con4ersion #ill be re7uired (chec9 out this(hp!""###$np$com"documents"applicationnote";101$pd3 app note rom JP3$) chose to usethe $4 Le4el ;tmea-L instead since the de4ice can #or9 at $8 no le4el con4ersion #ould bere7uired$6his is the Qnal de4ice that i made uses the L%111+&$ as the po#er reulator to reulatethe 124 rom the #all #art$

    Aor microcontrollers such as LP*1+- and LP*21- #hich run at $4 le4els no le4el con4ersion or

    modiQcation #ould be re7uired at all$;ll that #ould be needed to be done is to connect the r,t andthe round lines o the %icrocontroller to the Bluetooth module and you #ould ha4e a Bluetoothenabled microcontroller pro?ectM

    ple | Murli's Blog http://murlidharshenoy.wordpress.com/category/simple/

    f 14 24-12-2013 11:28

  • 8/13/2019 Simple _ Murli's Blog

    11/14

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"10"boardtop$?p3

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"10"boardboom$?p3(hp!""murlidharshenoy$Qles$#ordpress$com"2011"10"boardtop$?p36he board #as Qrst desined#ith the ;tmea- then i added the $4 reulator and s#itched o4er to the ;tmea-L$6he %osetsand other de4ices onboard are or another pro?ect that im currently #or9in on$Oill Post about thepro?ect in my net post$Post in the *omments belo# #hat you thin9 about it M

    ple | Murli's Blog http://murlidharshenoy.wordpress.com/category/simple/

    f 14 24-12-2013 11:28

  • 8/13/2019 Simple _ Murli's Blog

    12/14

    (hp!""murlidharshenoy$Qles$#ordpress$com"2011"10"21020112.$?p3

    Posted in arduino, aubtm&20, Bluetooth, simple Y 6aed arduino Y 10+ *omments

    1 watt High Efficiency Power LED lamp

    Posted on Fuly 5, 200. by murlidharshenoy

    (hp!""murlidharshenoy$Qles$#ordpress$com"200."0+"050+200.1$?p3

    (hp!""murlidharshenoy$Qles$#ordpress$com"200."0+"050+200.2-$?p3(hp!""murlidharshenoy$Qles$#ordpress$com"200."0+"050+200.25$?p3

    6hese Days po#er leds are a4ailable 4ery cheap$) had seen a lot o stuU on the net about the S1 #aledT and i ell instantly in lo4e #ith these beautiesMM6hese babies ha4e a 4ery hih lumen per #a

    output as compared to either incandescent or the ourescent technoloies$Aor the layman this means4ery hih e^ciency&you et more ban or your buc9$But dri4in these thins may be a bit di^cult $) did some reasearch and ound that the humble resistor #e all connect to the leds #hile dri4in the

    usual 5mm leds does not #or9 4ery e^ciently or the po#er leds and hence complicated dri4ercircuits are re7uired$to understand ho# the dri4er #or9s #e need to Qrst understand the basic

    principle on #hich the leds #or9$ LEDs are current dri4en de4ices i$e one can increase the brihtnesso the LEDs by increasin the current throuh them$ 'ounds simple rihtMM$But it is much complicatedthan that the LEDs re7uire a particular or#ard 4oltae 9no#n asor#ard brea9o4er 4oltae$ 6his is

    the 4oltae re7uired to [turn on the LED$Aor #hite LEDs this is usually $2&$ 4$ Red and reenLEDs usually ha4e a much lo#er or#ard brea9o4er 4oltae$Ince the or#ard brea9o4er is reached

    the leds literally act as a short circuit hence the current limitin resistor$6hese resistors cannot beused because o aorementioned reasons$:ence #e use a constant current source$ '%P'(s#itched

    mode po#er supply3s are usually used as a source or po#er LEDs$ 6hey usually s#itch on and oU at

    a 4ery hih re7uency$;nd that too at a 4ery hih e^ciency o about -5&.5$ 6he only dra#bac9 osuch a po#er supply is the prohibiti4e cost,especially #hen the supply current is in a couple o

    amperes

    (hp!""murlidharshenoy$Qles$#ordpress$com"200."0+

    ple | Murli's Blog http://murlidharshenoy.wordpress.com/category/simple/

    f 14 24-12-2013 11:28

  • 8/13/2019 Simple _ Murli's Blog

    13/14

    "050+200.25$?p3

    ;ll said and done i decided to ma9e my o#n 1#a led lamp$ )m usin a 1# LED #ith nothin but a printed on it as you can see(i thin9 this miht be some cheap chinese made replica o the philips

    lumileds lueon )3$ ;n lm1+ ad?ustable 4olatae reulator and a $. ohm 1 #a resistor$ ; heatsin9 isal4aed rom an old 68 recei4er bo$)m usin a no9ia mobile charer model ;*P&12E has a ratedoutput o 5$+4_-00ma$But my multiimeter a4e me an output o +4MM maybe because it #as the open

    circuit 4oltae$

    ) chose the lm1+ because it has a constant current mode (see the application notes(hp!""###$national$com"mp"L%"L%1+$html33 and also its damn cheap$6he lm1+ can handle

    currents upto 1$5; $) suest aachin a heatsin9 to the Lm1+ as #ell as theLED$ ;ltouh theL%1+ has thermal protection buit in the led may heat up and an o4erheated LED is as ood as dead$6he L%1+ reulator i4es out a constant 4oltae o 1,25 4olts bet#een ;DF and 8out, so by addin

    a resistor bet#een these t#o outputs, youll et a constant current$to Qnd the resistance 4alue use

    ohms la# 8=)R$:ere the 8=1$254 and re7uired ) is $50; hence #e et R as $5+1ohms$ the neareststandard 4alue is $ohm $But #e #ill use the $.ohm as a sae measure$ 6he constant current sourcehas a 4oltae drop o 4$ ;nd since the 4oltae drop across the LED is $2 4 #e #ould re7uire

    around 4 as 4cc$;4oid usin hiher 4olate po#er supplies than re7uired since ecess 4oltae is#asted as heat$ ) suest usin a supply o to . 4olt$;lso the #aae o the resistors may be hih

    enouh to handle the heat enerated$6he Qnished product is sho#n belo#$6his miht not be the most e^cient #ay to po#er these 1#

    LEDs but its the simplest and the most cost eUecti4e$ 6he e^ciency may be increased by usin theriht supply 4oltae to reduce the po#er #astae$

    (hp!""murlidharshenoy$Qles$#ordpress$com"200."0+"050+200.1$?p3

    ple | Murli's Blog http://murlidharshenoy.wordpress.com/category/simple/

    f 14 24-12-2013 11:28

  • 8/13/2019 Simple _ Murli's Blog

    14/14

    (hp!""murlidharshenoy$Qles$#ordpress$com"200."0+

    "050+200.2.$?p3Posted in po#er LED, simple Y 2 *omments

    Blo at OordPress$com$ Y 6he Rusty Grune 6heme$

    Aollo#

    Follow Murli's Blog

    Po#ered by OordPress$com

    ple | Murli's Blog http://murlidharshenoy.wordpress.com/category/simple/