My first Arduino project: PWM RGB LED strip

Here you can discuss things that are not directly related to running or using XBMC4XBOX.
Post Reply
User avatar
Xphazer
Posts: 524
Joined: Wed Jul 04, 2012 4:39 am
Location: Montréal
Has thanked: 240 times
Been thanked: 106 times

My first Arduino project: PWM RGB LED strip

Post by Xphazer »

This is my first arduino project, I built it last night. Lovely ! Very easy to work with these little things. :)
Click here to watch the video in 1080p

Original tutorial
User avatar
professor_jonny
Posts: 1298
Joined: Thu Jul 05, 2012 5:41 am
Location: New Zealand
Has thanked: 66 times
Been thanked: 196 times

Re: My first Arduino project: PWM RGB LED strip

Post by professor_jonny »

welcome to the world of micro controllers :-)
i have done a fair bit but never really used the audrino software.
i made a capacitive discharge spot wielder as my most recent project.

you could extend that to provide abmerlight for the xbox you just need to use i2c to read in the analogue values from the xbox :-)
User avatar
BuZz
Site Admin
Posts: 1891
Joined: Wed Jul 04, 2012 12:50 am
Location: UK
Has thanked: 66 times
Been thanked: 423 times
Contact:

Re: My first Arduino project: PWM RGB LED strip

Post by BuZz »

nice work :)
User avatar
Xphazer
Posts: 524
Joined: Wed Jul 04, 2012 4:39 am
Location: Montréal
Has thanked: 240 times
Been thanked: 106 times

Re: My first Arduino project: PWM RGB LED strip

Post by Xphazer »

@professor_jonny: Yeah thats where I'm heading to. I'm crazy about ambilight /boblight these days.
Couple weeks ago I hacked my Ikea Dioder. Flashed the onboard pic microcontroller. Very cool project. http://gabriel-lg.github.io/Ambioder/
And I'm glad I did my first steps on boblight using a single channel setup. But now its time for more.
With this Arduino Uno, I can have 2 channel (well, 6 channel: R+G+B+R+G+B) without too much trouble. (Might be possible to do more but not for my skills ATM)
For now I think I will start by getting into the code a bit more, and write my own code to strobe some LED like some cops light. And maybe add a push button to switch patterns. :grin:

On the Xbox what would be the best would be to make a client compatible with the boblight daemon.
So no special hardware would be required on the Xbox.
Only send the boblight data over the network so the device running the daemon can be anything. (RPi, Arduino attached to an OpenWRT router, PC.. ect ect)
Meanwhile if you know how to use the i2c directly from the the LPC without a modchip, that would be very cool!
Not that I don't have modchips with i2c, but it would be nice to know if its possible.
HackingTheXbox_Free.pdf wrote:LPC Connector:
Pin #13 - SCL - I2C serial clock
Pin #14 - SDA - I2C serial data
A spot welder, that sound like a very nice project. :smile:

@BuZz: Thanks a lot mate. :razz:
User avatar
xman
Posts: 1289
Joined: Wed Jul 04, 2012 2:30 pm
Location: Sydney, Australia
Has thanked: 55 times
Been thanked: 168 times

Re: My first Arduino project: PWM RGB LED strip

Post by xman »

Xphazer wrote:
HackingTheXbox_Free.pdf wrote:LPC Connector:
Pin #13 - SCL - I2C serial clock
Pin #14 - SDA - I2C serial data
A spot welder, that sound like a very nice project. :smile:
Oww, I must of missed that part. Interesting, I thought I needed a modchip that sorted the serial output. I wonder if I can drive a serial LCD display direct from those LPC ports?.

And very nice project XPH by the way.
User avatar
professor_jonny
Posts: 1298
Joined: Thu Jul 05, 2012 5:41 am
Location: New Zealand
Has thanked: 66 times
Been thanked: 196 times

Re: My first Arduino project: PWM RGB LED strip

Post by professor_jonny »

xman wrote: Oww, I must of missed that part. Interesting, I thought I needed a modchip that sorted the serial output. I wonder if I can drive a serial LCD display direct from those LPC ports?.

And very nice project XPH by the way.
yes and no
most screens dont come in i2c options but is an addon interface between a screen and i2c interface.

the i think the xennium mod chip uses i2c for screen display where all the others hang their data off the lcp bus controlling the

this would be a great start it is cheap too:
https://www.jameco.com/webapp/wcs/store ... Id=2157407

this is tipically what you will find:
http://www.spikenzielabs.com/SpikenzieL ... I_LCD.html

i dont know how amberlight works but i believe it works over i2c because amberlight on the smartxxchips as well as lcd.

microcontrollers are 5v too and on the xbox is 3.3v so you need a logic level shifter to XPH

there are pictures in my photo bucket of my spot wielder:
Image

Image

Image
Last edited by professor_jonny on Sun Jul 07, 2013 12:11 pm, edited 1 time in total.
User avatar
xman
Posts: 1289
Joined: Wed Jul 04, 2012 2:30 pm
Location: Sydney, Australia
Has thanked: 55 times
Been thanked: 168 times

Re: My first Arduino project: PWM RGB LED strip

Post by xman »

Cool spot welder PJ. I was looking at a similar use for these boards, it was a cutting that cut through thin steel. This is the LCD displays I have and it is also , my source for displays and electronics. I think you will find the pricing a bit more realistic ;) .............http://www.ebay.com/itm/Serial-IIC-I2C- ... 43bd118085
User avatar
professor_jonny
Posts: 1298
Joined: Thu Jul 05, 2012 5:41 am
Location: New Zealand
Has thanked: 66 times
Been thanked: 196 times

Re: My first Arduino project: PWM RGB LED strip

Post by professor_jonny »

xman wrote:Cool spot welder PJ. I was looking at a similar use for these boards, it was a cutting that cut through thin steel. This is the LCD displays I have and it is also , my source for displays and electronics. I think you will find the pricing a bit more realistic ;) .............http://www.ebay.com/itm/Serial-IIC-I2C- ... 43bd118085
a i2c lcd display is easy enough to attach but xbmc will need to be modified the data used to write to the display are not based of the audrino librarys as they were not around then it will be likely that the audrino i2c/spi lcd library's will need to be ported into the into xbmc source and buffering the display data as they are just dumb displays all the smarts were done in the modchip controller or xbmc.

as the xbox is 3.3volt you will need a level shifter to connect with the xbox i2c port also the one i listed has an embedded level shifter and is dotmatrix so you could do basic vector graphics and dotmatrix pictures.
User avatar
professor_jonny
Posts: 1298
Joined: Thu Jul 05, 2012 5:41 am
Location: New Zealand
Has thanked: 66 times
Been thanked: 196 times

Re: My first Arduino project: PWM RGB LED strip

Post by professor_jonny »

if you got a 20x4 hd44780 i2c display as you listed and put a level shifter in between and changed the modchip to xennium hd44780 in xbmc it might just work? i dont really know if the mod chip did a direct pass through of the dispaly data of if it insome way buffered or converted it?

in using an attiny and using the onboard i2c port as in and bit banging the spare pins you could have 2 serial ports and the chip would buffer the display data and do any conversion without changing xbmc source witch would be better.
User avatar
xman
Posts: 1289
Joined: Wed Jul 04, 2012 2:30 pm
Location: Sydney, Australia
Has thanked: 55 times
Been thanked: 168 times

Re: My first Arduino project: PWM RGB LED strip

Post by xman »

professor_jonny wrote:if you got a 20x4 hd44780 i2c display as you listed and put a level shifter in between and changed the modchip to xennium hd44780 in xbmc it might just work? i dont really know if the mod chip did a direct pass through of the dispaly data of if it insome way buffered or converted it?

in using an attiny and using the onboard i2c port as in and bit banging the spare pins you could have 2 serial ports and the chip would buffer the display data and do any conversion without changing xbmc source witch would be better.
See I know about the XBMC displays settings needing to be set as a Xenium so the i2c display will work but I wasn't aware the LCP port already had serial output. I thought the Xenium was required to provide it. My Xenium modchip has duel serial output ports like this....
Xenium_ICE_SPI Connector.jpg
May be wise to meter and see if they are actually just a past through or just via a chip to enable twin outputs. The XBMC i2c data may well be already to use with these displays without needing the chip for it.
User avatar
professor_jonny
Posts: 1298
Joined: Thu Jul 05, 2012 5:41 am
Location: New Zealand
Has thanked: 66 times
Been thanked: 196 times

Re: My first Arduino project: PWM RGB LED strip

Post by professor_jonny »

spi and i2c are not the same thing spi is a full or half duplex multi drop protocol with external select adress pin.
i2c is multi drop half duplex and has slave negoation ver the protocol they are different from each other.

I would say that chip probally converts lcp data to spi or i2c data to spi as a guess.

the xbox has a native i2c port and is available to use it is also used by the eeprom and whatever else if you connect a level shifter to the xbox and connect an i2c dispaly i dont know what will happen but it would probally require a driver on the xbmc side.
User avatar
Xphazer
Posts: 524
Joined: Wed Jul 04, 2012 4:39 am
Location: Montréal
Has thanked: 240 times
Been thanked: 106 times

Re: My first Arduino project: PWM RGB LED strip

Post by Xphazer »

User avatar
professor_jonny
Posts: 1298
Joined: Thu Jul 05, 2012 5:41 am
Location: New Zealand
Has thanked: 66 times
Been thanked: 196 times

Re: My first Arduino project: PWM RGB LED strip

Post by professor_jonny »

Don't get caught atempting to be a police car I know it is tempting :-)

it is amazing how bright it is really.

below is my code for the spot wielder it may be of intrest?
basically you operate the input bt it drives the fet output for a time set via the pot then waits some time and then does a final spot to finish the wield.

the pot (adc) sets the time to hold the fet on and ld1 is the led for feedback.

the initial spot is to burn off oil etc and the second is to actually wield the metals

i envisioned to extend it to drive a fet to charge cap to a specific voltage and a dumping resistor to control the power of the spot but i ended up selling it and building this :

http://frikkieg.blogspot.co.nz/

Code: Select all

$regfile = "attiny13.dat"
$crystal = 4800000
$hwstack = 16
$swstack = 16
$framesize = 16                                             'min 6 for long prints
'          ----
'     Rst |1xx8| Vcc
'Ld1  Pb3 |2 17| Pb2 adc
'bt   Pb4 |3  6| Pb1
'     Gnd |4x 5| Pb0 fet
'          ----
'Config Portb.3 = Input


Ip_btn Alias Pinb.4
Op_btn Alias Portb.4
Config Op_btn = Input
Set Op_btn

Op_ld1 Alias Portb.3
Config Op_ld1 = Output

Op_relay Alias Portb.0
Config Op_relay = Output
Reset Op_relay


Config Adc = Single , Prescaler = Auto , Reference = Avcc
Start Adc


'Op_buz Alias Portb.3
'Config Op_relay = Output
Const Con_adc_time = 1

Const Con_on_time1 = 60
'sec, warm up time

Const Con_on_time2 = 600
'sec, how often to check for activity

Const Con_on_time_active = 150
'5 per sec, 30 sec = 150


Dim Var_counter1 As Word
'Dim Var_counter2 As Word
'Dim Var_counter3 As Word
Dim Var_flag_timeout As Bit
Dim Var_adc As Word
Dim Var_wait As Word

'------------------------------------------------------------
'$sim
Wait 1

   For Var_counter1 = 1 To 8
      Set Op_ld1
      Waitms 150
      Reset Op_ld1
      Waitms 150
      Next

      Wait 1

Main:
Gosub Sub_wait_for_button_main
   Var_adc = Getadc(con_adc_time)
   Var_adc = Var_adc / 15

   Var_wait = 1 + Var_adc

'   For Var_counter1 = 1 To 100
      Set Op_ld1
      Set Op_relay

      Waitms Var_wait

      Reset Op_relay
      Reset Op_ld1

Waitms 10
   Var_wait = 5 + Var_adc

      Set Op_ld1
      Set Op_relay

      Waitms Var_wait

      Reset Op_relay
      Reset Op_ld1
      Waitms Var_wait
      Waitms Var_wait
      Waitms Var_wait
'   Next

   For Var_counter1 = 1 To 2
      Set Op_ld1
      Waitms 150
      Reset Op_ld1
      Waitms 150
      Next
      Wait 2

Goto Main







Sub_wait_for_button_main:
   If Ip_btn = 1 Then Goto Sub_wait_for_button_main
Return
Post Reply