Showing posts with label LED. Show all posts
Showing posts with label LED. Show all posts

Thursday, July 9, 2009

Simmons LED Display Part 4: Django Web App


This is part four of my series on the Simmons LED Display. I'm going to describe the implementation of the web-based front end.

Here are some of the specs I wrote up for the web applic
ation:
  1. Users go to the Simmons LED website to enter messages.
  2. The Simmons LED website tells the user when their message will be displayed.
  3. The Simmons LED server displays the message at the given time for a fixed time (2 minutes).
  4. Only Simmons residents will be able to post messages.
  5. Messages will be profanity/obscenity/inappropriate filtered.
It's a pretty simple idea, the only non-straightforward aspect is some misdirection in the form of a database. The database allows for separation betw
een the display code and the web page code. Here's the flow of the program:
  1. A user visits the Simmons LED website.
  2. The user is allowed access if they are a Simmons resident.
  3. A message gets entered to the website.
  4. The website profanity filters the message.
  5. The website saves the message, with the current time, into the database.
  6. The website asks the database how many messages there are in line.
  7. The website tells the user when their message will be displayed.
  8. The display service repeatedly checks the database for new messages.
  9. The display service displays the oldest message for two minutes, then marks it as displayed.
The purpose of the database is to buffer the inputs, in case tons of users post messages all at once.

The Django code is shown below:

forms.py
models.py

views.py
Note: this code doesn't contain the profanity filter. I am planning on adding this as a validator in the message model.

The (very messy) html templates are coming soon.

Monday, July 6, 2009

Simmons LED Display Part 3: Software Implementation

This is part 3 of my series of posts on the Simmons LED Display. I'm going to discuss my implementation of the control software used to operate the display.

The software stack is comprised of four parts: a web service used to input messages, a cron-type service used to keep checking for new messages to display, a driver service used to convert the message strings into synchronized pin timings and the microcontroller code used to actually turn on and off the LEDs.

Even though the C/C++ environment of the Arduino is super-easy as far as microcontrollers go, I chose to keep most of the logic on the computer running the web service. This meant I could implement the hard code in Python, making my life much easier.

An overview of the software stack is shown to the left. It might look like a mess: that's because it is one. I'll attach all of the source code files soon, as well as instructions on how to use them.

Coming Next: Django App Sources

Saturday, July 4, 2009

Simmons LED Display Part 2: Hardware Implementation

I chose to use the Arduino microcontroller for this project for many reasons. They're relatively cheap, easy to program and even easier to use. You literally just plug the device into your computer via a standard USB cable and you're ready to program. The Arduinos each have 14 total I/O pins, two of which are used by the onboard serial communications chip. This means you have 12 free pins to play with on each device, if you still want to communicate with a computer.

I needed 36 total pins (6 by 6), and I wasn't confident enough to try to learn how to build a multiplexing circuit, so I just decided to use multiple Arduinos. This made even more sense considering I needed to light up LEDs on multiple floors of my building, and wanted to avoid long cable runs. For symmetry, I bought 4 Arduinos, to have 2 on each floor.

After several unsuccessful attempts to make the power boards on Radio Shack stripboards, I finally discovered Winford Engineering. They carry excellent prototyping products. Some pictures of the completed power boards are shown to the left. Each power circuit is just one MOSFET and one 2 Ohm Resistor. The Digikey part numbers I used are: IRFZ14PBF and 23J2R0E. The schematics are coming soon.

t

Simmons LED Display Part 1: Architecture

This is the first post of a series documenting the Simmons Hall LED Display I worked on in September 2008. The idea for the project came from an earlier project by Dheera Venkatraman. Over the years, Dheera's display fell apart. I decided to reimplement the 6 by 6 Luxeon LED Display as a way to learn a little bit more about electronics and microcontrollers.

The display spans two floors of Simmons Hall, an undergraduate dormitory at MIT. Housed in the student gym, the display is visible far into Boston at night and is capable of scrolling most alphanumeric characters to display messages.

Just a little warning before I get into the architecture of this project: I know very little about electronics, so most of the decisions I made about the implementation of this display were uneducated guesses and probably represent the worst way to do most things. Now, onto the design.

I wanted the display to be very easily programmable. This meant that anyone should be able to change the message without needing to know how to program a
PIC or rewire the circuit. I also wanted to eventually build a web-interface for the display, so people could change the message in real time without having to even see the circuitry.

I also wanted to keep the electronics simple and expandable in case someone wanted to maintain it later. With these things in mind, the general architecture I arrived at is shown to the left.

I would have a computer connected to multiple microcontrollers, each controlling multiple LED's. The computer's role would be to decide which LED's needed to be turned on and for how long to print a given message. The computer would then tell the microcontrollers to turn pins on and off to form messages. The microcontrollers would act as slaves, listening to the computer for instructions.
Cracking open my copy of The Art Of Electronics, I found a small problem. The Luxeon LEDs I planned on using drew a full amp of power each. No microcontroller I could find could source that much current. I got some help from a couple electrical engineers and designed a power circuit for the LEDs that could be operated by a TTL signal from a microcontroller. The architecture then changed to what is shown to the left.

The microcontrollers toggle MOSFETs on the power boards which light up the LEDs. I wanted to place a power board on each floor to avoid running my own power cables too far.