Using Stellaris LaunchPad for ambient lighting

Finally!!!
Very first time, when controlling led strip actually works.

Update 4.2: Added link to GitHub-repository.

A long time ago I bought Stellaris LaunchPad just for fun, and because it was so cheap and even included free international shipping.  The thing is, that there is no joy with microcontroller if there isn’t anything sensor or device to control. That’s why I also bought 1m addressable led strip from adafruit for ambient lighting purposes.

After wiring these two together, I could start programming with a Launchpad. The led strip uses a somewhat unknown chip named LPD8806, and there is not datasheet available whatsoever. However, adafruit offers led strip driving library for  this chip. Usually these strips uses SPI-like protocol, and luckily, so does this one too. But anyway, I had to port arduino-based library to use StellarisWare-libraries. After a while of bitbanging, I finally got the library working just fine.

You can find my implementation of LPD8806-library and other source code at my GitHub repository

Hardware

Connecting led strip to LaunchPad is very easy. Just match DI (Data In) and CI (Clock In) pins to LaunchPad’s hardware-SPI pins and you are good to go. I decided to use SSI0-interface, so I connected PA2 to CI and PA5 to DI.

Finally LaunchPad fits to case. Also all connectors glued in place.
Finally LaunchPad fits to case. Also all connectors glued in place.

I’m using LaunchPad’s Device USB-port as data-interface for the pc-software. That way, I can use Debug USB-port for debugging and have full-control over the device-usb port. Also using this setup, I can create program that acts just like native LightPack-device (by using same USB Product ID and Vendor ID).

Finished case
Finished case. Connectors front to back: Power (front), Debug USB (front), Device USB (side), 4-wires to LEDs (back)

I use external adapter just for distributing power to led strip, because USB-ports usually limits current to 500mA and leds takes about 2A when full brightness. It worked perfectly without any external power when using powered USB hub, but after connecting directly to the PC, then it just won’t work.

I also bought a nice plastic case for this project. Sadly, It was just few millimeters too low to fit. LaunchPad has female and male headers, so it’s surprisingly tall. I just pushed all used pins slightly outwards and then the case fits just perfectly.

Programming, software, and more…

I spent a lot of time researching other ambient lighting projects. Most of the time projects are using atmoligt, boblight, Server IR or custom software in PC to control lighting and screen capturing. I couldn’t get atmolight-software to connect LaunchPad’s virtual COM-port, or anywhere at all. Always same error “Error while connecting to COM-port”, or something like that. Anyway, I got more luck with Server IR, which is very polished software, compared to atmolight or boblight.

serverir

If you look closely, you can see that the Device is set to “Adalight”, which means that the connected device is using Adalight-protocol. That protocol specifies data structure when sent to LaunchPad. Protocol itself is very simple. Start looking for start bytes “Ada”, and then three bytes for checksum and led count, and after that, just bunch of bytes in RGB-order specifying each “section” or led. Depeding on configuration, but I’m currently using 32 sections for 32 leds and all leds are controlled directly from PC.

It worth mentioning that many other protocols supports only 3-4 sections for left/top/right/bottom. However, I discovered even better software…

Lightpack

lightpack

Lightpack is open source project for arduino-based lightpack-boards and leds. It also features support for adalight protocol.  It has very simple and elegant UI, support for profiles and more. See the project page at google code.

Here just few reason for using it, comparing to Server IR:

  • It has better support for screen capturing. (No need for PlayClaw)
  • API-support
  • All configurations in easily modifiable INI-formated text file.
  • Open source

Summary

This was really first time for me to work with embedded devices. Using StellarisWare with very good eclipse-based Code Composer Studio, it just couldn’t be easier. Of course there were awful a lot of FaultISR-interrupts and other very strange errors, caused by my own mistakes…

And sorry, I speak broken English!! :(

Resources

Here few links that were very helpful:

 

Dable – Update 1.1

As I said, I was concerned about performance and this is basicly fix for that. Also few other things got fix as well. There is still plenty of bugs, in code and in assets, but they aren’t so important ones, so I decided to leave them.

Changes:

* Now city background continues seamlessly to grass areas
* Fixed healing effect
* Changed to shadow textures, now required texture size from gpu is 4096x4096
* All static entities (excluding cave) uses now static geometry
* Fullscreen antialiasing works this time
* Now is possible to start a new game after death
* Added loading screen when game is launched
* Better memory handling

Download

Download Dable 1.1

Dable

It has been long time, when I last time participate in month’s EGP. I have been working with my very own Component-based entity system, which is still very primitive, but working. Current theme ‘Cheap Clones‘ was perfect theme to test my CBE-system.

It took whole 7-days to develop this game, and it’s still very buggy and have pretty bad performance (fixed with update). I made my own collision library with simple SAT-collision testing, but it turns out that it is so slow, that I could use that only with player, so enemies are running through walls.

Anyway, I think that this game fits perfectly to current theme, so there you have it.

Few screenshots as always:

I must give a credit to following people:

And for great music:

Requirements:

DOWNLOAD

Original, buggy, version is also available.

IlmaNoxAir Is Back!

Ensimmäinen julkaistu peli, mitä olen ikinä tehnyt, katosi vähän aikaa sitten, kun Suomipelit.com päivittyi, ja sittemmin kuoli. Kuitenkin FreegameArchive on hostannut tätä peliä jo vuodesta 2008. Onneksi satuin muutama päivä sitten googlettamaan tätä peliä ja löysin sen.

Latasin sen tietenkin itselle, ja tästä lähties hostaan sitä myös itse:

LATAA

English summary:

My first game disappeared when Suomipelit.com updated their site (and afterwards went down). Luckily I found it again on FreegameArchive.

Because game is in finnish, it might be hard to play it, but if you are really into it, here is few things to get you playing:

– Select first in the menu (Aloita peli == Start game).

– Press space few times to pass the story screen.

Controls:

  • Arrow keys to move
  • Left Shift to jump

You can quit game anytime by pressing Esc.

DOWLOAD

NEND

Yet another EGP-game, but this time it has special reward. That’s why I was thinking something very arcade game and something very easy to play. The theme was neverending which gives me two choices. Make game, where user creates the content (like Tower of Goo) or content is generated on fly.

I would really like to create game, where user creates the content, because they are likely more fun, but I wasn’t able to get good ideas. Maybe better luck ‘next time’.

NEND is simple and addictive game where you need control ship in right track. Uses two buttons to control and blocks keeps coming faster and faster. It has title screen, which shows controls and way to get playing the game. It has music, but you can turn them off. No sound effects at all, because I think that it doesn’t need them.

Here is few screenshot from the game:

Start screen

Gameplay screenshot

Controls:

  • Left & Right arrow(alternatively A, D) – Control the ship
    • Press twice left or right to jump over space
  • Enter – Restart
  • M – Mute Music
  • Esc – Quit

Note:

I strongly recommend playing with 8xFSAA and with VSync. (without VSync game bugs at begining, not bad, but still)

You can reconfigure video settings by removing ogre.cfg -file.

Requirements:

DOWNLOAD

CatchIt

After a while, I finally decided to learn something about Ogre. I created simple game, which doesn’t do anything fancy but meanwhile was very interesting project for me. Also it is made in 5 days (including installing OgreSDK).

Artwork for the game is made with Blender and uses Ogre Mesh Exporter and Ogre Scene Exporter. In Ogre scene is then loaded with new DotScene loader. Player and cubes doesn’t belong to scene, because in code there is own classes to handle those meshes.

I got one big problem, because I couldn’t get anything text rendered to screen. Even when font and overlay was correctly defined. This is bug in Ogre (1.7-series), but it took one whole day to figure that out.

And word about requirements:

Because It’s made with Visual Studio 2010 it needs newest DirectX and Visual Studio c++ Runtime which you can download on following links:

Microsoft Visual C++ 2010 Redistributable Package (x86)

Newest DirectX you probably have, but I will provide link, just in case:

DirectX End-User Runtime Web Installer

And finally download for the game:

DOWNLOAD