All About Circuits Forum Coding Microcontroller Program for Spinning LED Display
 User Name Remember Me? Password
 Register Blogs FAQ Members List Today's Posts Search Today's Posts Mark Forums Read

 Notices Welcome to the All About Circuits forums.Our forum is a place where thousands of students, hobbyists and professionals from around the world share knowledge and ideas. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us.

 Programmer's Corner Discussion forum for all aspects of programming and software engineering. Any software programming language welcome: C, C++, C#, Fortran, Java, Matlab, etc.

#1
02-22-2011, 02:29 AM
 dannybeckett Senior Member Join Date: Dec 2009 Posts: 136
Coding Microcontroller Program for Spinning LED Display

Hi guys,

Im in the middle of making a spinning LED display using a PIC16F88. Save a long winded explanation of the device the following is a video of something very simalar to mine:

http://www.youtube.com/watch?v=fUrwy3l0XfA

And pictures:

http://hackedgadgets.com/2008/12/12/...led-display-2/

Our setup is basically the same as that, but I am not an experienced PIC programmer. Would anyone be able to throw me in the right direction with regards to programming the microcontroller in a simalar project? I will have an optical sensor triggering every revolution, going into the uC, the spinning portion of the project has been created, the next step is basically programming the chip.

My thoughts -

The program has a constant within it which specifies the number of horizontal 'pixels' that occupy the circumference of the spinning arm. The program measures the time it takes for 1 revolution of the arm and divides that time by the pixel number. This provides the time it takes the arm to rotate from one specific pixel to the one neighbouring it. Using this time you can flash the LEDs on and off accordingly, to create an image.

Does this sound reasonable to anyone? Maybe there is another way I have not thought of that this can be done? Any help at all is massively appreciated.
#2
02-22-2011, 12:58 PM
 John P Senior Member Join Date: Oct 2008 Location: Massachusetts Posts: 1,313

Sounds right to me.

It didn't look as if the unit in that video had a sensor, and the result was that the "location" of the display was wandering around. But sync it to the motion of the arm, and that would be cured.

You'd better have a good plan to get the power and signals onto the moving arm. Or maybe all your electronics is out there rotating, and you run it off batteries?
#3
02-22-2011, 02:35 PM
 dannybeckett Senior Member Join Date: Dec 2009 Posts: 136

The electronics are spinning with the arm, only the power is needed to be brushed to the arm, so +5V and ground. Do you have any idea on how I could begin to code the microcontroller for this kind of project? I'm quite stuck!

Thanks again
#4
02-22-2011, 04:51 PM
 Markd77 Senior Member Join Date: Sep 2009 Location: Birmingham Posts: 2,784 Blog Entries: 1

What code have you got so far?
If you haven't started yet I'd suggest trying for a line first (just turn on all the LEDs for a very short time every revolution).
The speed will be fairly constant once it has got going so you can use a constant time for the pixel widths to start with and then see if you need to make it more complicated.
#5
02-22-2011, 04:52 PM
 spinnaker Senior Member Join Date: Oct 2009 Location: Pittsburgh, PA U.S.A. Posts: 3,650

Quote:
 Originally Posted by dannybeckett The electronics are spinning with the arm, only the power is needed to be brushed to the arm, so +5V and ground. Do you have any idea on how I could begin to code the microcontroller for this kind of project? I'm quite stuck! Thanks again
What experience do you have with writing code for a microchip? This is not an easy project.

It is on my list of things to to.
#6
02-22-2011, 05:26 PM
 dannybeckett Senior Member Join Date: Dec 2009 Posts: 136

Markd77:
Yes this is a great start. As soon as I have got the pic development board that's coming in the post I will try light 1 line of the display. I have a feeling I am going to need to use interrupts for the RPM signal?

spinnaker:
Very limited if im honest. Ive written a few things in assembly and don't really know how to code for microcontrollers in C. I am willing to learn (and will do very quicky) if you know of any decent resources knocking around the internet?
#7
02-22-2011, 05:49 PM
 spinnaker Senior Member Join Date: Oct 2009 Location: Pittsburgh, PA U.S.A. Posts: 3,650

Then I would start off small. Basically what you need to do with this project is to be able to turn on 8 or 10 LEDs individually. I would start there. Once you have that then you can move on.

The next step would be to determine when the lights will be turned on. This will require a timer interrupt and is going to be the most difficult part of your project. The problem is going to be it that the board will be spinning and there will be no easy way to debug it. I was thinking of using two microchips and wireless communication. The stationary one would do all of the work and the spinning one would just interpret commands and turn on the LEDs.
#8
02-22-2011, 06:55 PM
 spinnaker Senior Member Join Date: Oct 2009 Location: Pittsburgh, PA U.S.A. Posts: 3,650

Once you get you leds to light up and you start the spinning portion, a good step would be to get the line of leds to light up at a specific position.
#9
02-22-2011, 08:48 PM
 bertus Administrator Join Date: Apr 2008 Location: Amsterdam,Holland (GMT + 1) Posts: 12,097

Hello,

You could also use a slot photo interupter for synchronisation.
You start the pixel stream after the interupt has been.
That way the picture will stand still.

Bertus
__________________
You don't have to know everything, if you know where to find it.
When you do ask questions, you may look stupid.
When you do NOT ask questions, you will STAY stupid.

It would be nice to have the Timezone ( GMT +/- x ) in the location field in the profile.
(User CP -> Edit Your Details)
#10
02-22-2011, 09:29 PM
 John P Senior Member Join Date: Oct 2008 Location: Massachusetts Posts: 1,313

Here's how I would do it. First, set up a repeating timer interrupt at something like 4KHz, and make it increment a counter for each occurrence. Set up another interrupt triggered by the optical switch. When that one operates, turn the timer on and zero both the time interval and the count of total number of timer intervals.

What you'll be doing is counting time intervals, and for each one you'll show a new output on the LEDs. Start with a single occurrence of all LEDs on for just one period, to verify that it happens at the same place each revolution--it should look like a narrow vertical bar. Then change the counting so that the LEDs are on for (say) 100 counts, and that'll give you a scale for how much display time you have over the time of one revolution. I'd expect that you want 1 horizontal pixel per timer interval, so once you've established this scale you might want to change the timer interval to match. And then, all you have to do is make up the actual display in terms of what gets shown for each successive timer interval. Dead easy.

 Tags coding, display, led, microcontroller, program, spinning

 Related Site Pages Section Title Worksheet Microcontroller principles Worksheet Digital display circuits Worksheet Passive integrator and differentiator circuits Textbook What is alternating current (AC)? : Basic Ac Theory Textbook Quantum devices : Solid-state Device Theory Textbook Quantum physics : Solid-state Device Theory

 Similar Threads Thread Thread Starter Forum Replies Last Post sloetyme The Projects Forum 7 12-13-2010 12:32 AM MingJae Homework Help 20 02-25-2010 01:54 PM ridge84 Embedded Systems and Microcontrollers 4 11-29-2009 09:35 PM zhhgw Homework Help 8 01-13-2008 04:55 AM bobank The Projects Forum 5 09-17-2007 09:25 AM

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Electronics Forums     General Electronics Chat     The Projects Forum     Homework Help     Electronics Resources Software, Microcomputing, and Communications Forums     Programmer's Corner     Embedded Systems and Microcontrollers     Computing and Networks     Radio and Communications Circuits and Projects     The Completed Projects Collection Abstract Forums     Math     Physics     General Science All About Circuits Commmunity Forums     Off-Topic     The Flea Market     Feedback and Suggestions

All times are GMT. The time now is 07:12 PM.

User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Powered by vBulletin
Copyright ©2000 - 2014, vBulletin Solutions, Inc.