All About Circuits Forum  

Go Back   All About Circuits Forum > Software, Microcomputing, and Communications Forums > Programmer's Corner

Notices

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.

Reply   Post New Thread
 
Thread Tools Display Modes
  #1  
Old 02-22-2011, 02:29 AM
dannybeckett's Avatar
dannybeckett dannybeckett is offline
Senior Member
 
Join Date: Dec 2009
Posts: 136
Default 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.
Reply With Quote
  #2  
Old 02-22-2011, 12:58 PM
John P John P is online now
Senior Member
 
Join Date: Oct 2008
Location: Massachusetts
Posts: 1,273
Default

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?
Reply With Quote
  #3  
Old 02-22-2011, 02:35 PM
dannybeckett's Avatar
dannybeckett dannybeckett is offline
Senior Member
 
Join Date: Dec 2009
Posts: 136
Default

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
Reply With Quote
  #4  
Old 02-22-2011, 04:51 PM
Markd77's Avatar
Markd77 Markd77 is offline
Senior Member
 
Join Date: Sep 2009
Location: Birmingham
Posts: 2,750
Blog Entries: 1
Default

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.
Reply With Quote
  #5  
Old 02-22-2011, 04:52 PM
spinnaker's Avatar
spinnaker spinnaker is offline
Senior Member
 
Join Date: Oct 2009
Location: Pittsburgh, PA U.S.A.
Posts: 3,646
Default

Quote:
Originally Posted by dannybeckett View Post
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.
Reply With Quote
  #6  
Old 02-22-2011, 05:26 PM
dannybeckett's Avatar
dannybeckett dannybeckett is offline
Senior Member
 
Join Date: Dec 2009
Posts: 136
Default

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?
Reply With Quote
  #7  
Old 02-22-2011, 05:49 PM
spinnaker's Avatar
spinnaker spinnaker is offline
Senior Member
 
Join Date: Oct 2009
Location: Pittsburgh, PA U.S.A.
Posts: 3,646
Default

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.
Reply With Quote
  #8  
Old 02-22-2011, 06:55 PM
spinnaker's Avatar
spinnaker spinnaker is offline
Senior Member
 
Join Date: Oct 2009
Location: Pittsburgh, PA U.S.A.
Posts: 3,646
Default

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.
Reply With Quote
  #9  
Old 02-22-2011, 08:48 PM
bertus's Avatar
bertus bertus is online now
Super Moderator
 
Join Date: Apr 2008
Location: Amsterdam,Holland (GMT + 1)
Posts: 11,599
Default

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)
Reply With Quote
  #10  
Old 02-22-2011, 09:29 PM
John P John P is online now
Senior Member
 
Join Date: Oct 2008
Location: Massachusetts
Posts: 1,273
Default

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.
Reply With Quote
Reply   Post New Thread

Tags
, , , , ,


Similar Threads
Thread Thread Starter Forum Replies Last Post
LED Name Display Project Box sloetyme The Projects Forum 7 12-13-2010 12:32 AM
LED lamps getting hot MingJae Homework Help 20 02-25-2010 01:54 PM
Pls help me.Need advice ridge84 Embedded Systems and Microcontrollers 4 11-29-2009 09:35 PM
The Seven Segment Display zhhgw Homework Help 8 01-13-2008 04:55 AM
10 sec. countdown timer with LED display bobank The Projects Forum 5 09-17-2007 09:25 AM

Thread Tools
Display Modes

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 Jump


All times are GMT. The time now is 02:40 PM.


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