Shop OBEX P1 Docs P2 Docs Learn Events
Device for aligning eyes — Parallax Forums

Device for aligning eyes

Gunner0302Gunner0302 Posts: 12
edited 2012-07-26 19:40 in General Discussion
This is my first post ever! So be gentle, please. I make grow lights, they are simple and do not take too much to build. But I need to build a device that will help me realign my eyes after a work accident. This device needs to be approximately 24”X24”. It needs to have two concentric circles of 12 LEDs each. It needs to have push button switched located at the LED (or the LED can be in the switch) that when pushed it turns off the LED and randomly illuminates another LED. This is a timed event and I need to know how many LED I pushed in a given time limit. I need to be able to select the amount of time and display the count on a meter. I have tried a 555 timer, it is easy to get this to turn LEDs on and off but I could not find a way to make it randomly select a different LED. If there is any suggestion as to an IC that can help with this, or a simple way to accomplish this, I am all ears.

Comments

  • prof_brainoprof_braino Posts: 4,313
    edited 2012-07-24 11:27
    Okey dokey dominockie! You've come to the right place.

    You have lots of choices. Many of us would recommend the prop since it relatively cheap and way more powerful than most folks need, so you don't really have to worry about it coming up short.

    In order to make a proper selection, we need to know a bit more about what you want to do. Establishing clear and complete requirements is the single most critical factor to success.

    Can you draw a picture of what the device is supposed to look like, roughly?

    Can you tell us a resource on where you got the idea for realigning eyes using this method? I never heard of it before (like so many things on the earth).

    What kind of button, does it matter, what kind of times are we talking, does it matter, how many counts, is it unlimited, what kind of meter, what do mean by random, do you just want the light to jump around the ring on each button push?

    After we ask and answer about a zillion questions, we will have something that should be easy to build and code. Then everyone will find it easy to help since its clear what you want.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-24 11:28
    One of the Stamps or the Propeller could do this. You're talking about 24 LEDs and 24 pushbuttons which is more than either one can handle without simple (and cheap) I/O expander ICs. Specifically, three 74HC595s could handle the LEDs and three 74HC165s could handle the pushbuttons. There are plenty of examples for the Stamp showing how to use these ICs for I/O expansion. There's a chapter on each in the StampWorks Manual which you can download from Parallax. You'd use a simple serial LCD display to show the time (either to set the limit or show the time remaining) and the count of buttons pushed. You could use one pushbutton per digit of the time to set it and other pushbuttons to reset everything, set the time limit, or start the exercise. These other pushbuttons can be connected directly to the Stamp. The "What's a Microcontroller?" tutorial is a good source for other examples. The tutorials can be downloaded here.

    If you want to get cheap, you can use separate LEDs and pushbuttons. If you want nice, but relatively expensive, you can get lighted pushbuttons with both the LED and the pushbutton in the same device.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-07-24 11:42
    You can easily do it. The issue of I/O expansion can be dealt with in several ways.

    To drive the LEDs, a 4-to-16 demultiplexer chip for each set of 12 LEDs might be simpler than using the 74595 shift register. Similarly, there may be a reverse, multiplexer chip that can encode the pushed button. Time delay is easy.

    The Random number generation function is offered in both the BasicStamp and the Propeller.

    http://www.jaycar.com.au/images_uploaded/74HC154.PDF
  • Gunner0302Gunner0302 Posts: 12
    edited 2012-07-24 13:08
    The purpose of this devise is to exercise and test peripheral vision. Eye therapy teaches you to “Look Hard” and “Look Soft”. People that have had brain injuries tend to really focus on a spot and lose balance. Looking hard is like trying to read the part numbers on a Transistor, you have to really focus on the number, but when you do that you lose Peripheral Vision. When you “Look Soft” you can focus on an object but you can see what is in the foreground, around the edges and behind the object. Everything around the object is diplopic (Double vision)but your brain filters that out, well, until now because hopefully you will test if I am correct. This devise teaches you to look soft so you can see the LEDs. Your peripheral vision stabilizes your focal vision. When you see an object your eyes can focus on about three degrees spot, so when you look far away you can focus on a larger area, without peripheral vision your eyes would wonder around, and if you were Exophoric (Eyes pointed to the outside) or Endophoric (Cross-eyed) you would be diplopic in your sight picture. Have you ever met someone that has one eye looking at the curb and the other looking at the moon, that’s what my eyes do. So onto the device. The LEDs need to be placed in the same pattern as a clock face, just in two rows. By random I mean the lights just need to jump around on the selected circle, but only after the illuminated LED/switch is pushed. If I select the outside circle they need to stay on that circle. The display(Counter) needs to be able to show the count of how many LED switches were pushed in a given time span, say 34 buttons pushed in one minuet, but there should be no limit to the count. As for the timer, I think selection in 30 second intervals up to 5 minutes would be good, but a setting of one and two minutes would work just as well. No real need to display the timer, just when time is runs out the device stops generating random LED illumination, stop counting and chimes. The counter needs to be able to be cleared while energized and it needs to reset when turned on.
  • Gunner0302Gunner0302 Posts: 12
    edited 2012-07-24 13:11
    Thank you Mr. Green I will start reading!
  • Gunner0302Gunner0302 Posts: 12
    edited 2012-07-24 13:13
    Loopy, thank you. Looks promising
  • Gunner0302Gunner0302 Posts: 12
    edited 2012-07-24 14:28
    Mr. Green, when I went to the web site to download the StampWorks Manual I noticed all kinds of other materials there as well. Do I need to purchase any other items like the Parallax Professional Development
    Board?
  • kwinnkwinn Posts: 8,697
    edited 2012-07-24 19:47
    You can easily do it. The issue of I/O expansion can be dealt with in several ways.

    To drive the LEDs, a 4-to-16 demultiplexer chip for each set of 12 LEDs might be simpler than using the 74595 shift register. Similarly, there may be a reverse, multiplexer chip that can encode the pushed button. Time delay is easy.

    The Random number generation function is offered in both the BasicStamp and the Propeller.

    http://www.jaycar.com.au/images_uploaded/74HC154.PDF

    There is a reverse function chip. It is called a priority encoder. Take a look at the 74HC147 (1 of 8 inputs to 3 bits out) and 74HC148 (1 of 10 inputs to 4 bits out).
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-07-24 20:00
    Gunner,

    What's the total size (i.e. rectangular bounding-box dimensions) of the two LED arrays (both together and separately)?

    -Phil
  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-24 20:05
    You don't need to purchase anything yet. When you're ready to actually start trying stuff, you'll need some kind of Stamp board. The Professional Development Board is handy for testing and development of complex stuff, but you can also get a simpler development board like the Board of Education and use that with a larger separate breadboard. You could even use a Homework Board for development (just keep in mind that there are already 220 Ohm resistors on all of the Stamp I/O pins). You may want the Board of Education for learning and testing, then build the "real" circuit on something like a Super Carrier Board which is like the Board of Education, but with a solder area instead of a little breadboard.
  • Gunner0302Gunner0302 Posts: 12
    edited 2012-07-25 10:56
    24" X 24" X 3" All outside dimension, it does not have to be 3” thick it can be 1” thick if that’s enough room for the parts. One LED circle is 23" diameter and the small is 11" diameter with a single LED marking the origin.
  • Gunner0302Gunner0302 Posts: 12
    edited 2012-07-25 11:21
    I downloaded the data sheet for this device and was reading it. I know there were data sheets in school but that was four wars and 30 years ago. I don't recall IC's that was for the really smart guys, we just trouble shoot to the component and replace the board, we never went into detail. I am going to get smart on all this magic stuff like the Stamp and the 74HC154. Thank you for your help.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-07-25 11:41
    Take your time to decide what you need. The BasicStamp has 16 I/O pins and a serial port for programming and debugging. Phil's approach may be the best.

    If you use a parallel LCD, that with require 7 I/O pins minimum. A serial LCD is more expensive, but uses just 1 or 2. Alternatively, you could use the Debug interface with a computer to time displayed on a computer screen.

    The problem with the demultiplexers is that you need two and that would require another 8 i/O pins.
    Trying to use 8 to 3bit encoders to connect 24 buttons would require another 8 to 9 pins. I had not considered a timer display.

    Obviously, you are over the 16 pin limit. So the 74595 may be a much better solution as these can be chained together and require a minimum of 2 or 3 pins.

    I suspect you will prefer a parallel LCD in 4 bit mode for 7 i/o pins and the two sets of three shift registers - one set or input and the other for LEDs, for maybe another 6 i/o. That is a total of 13 pins.

    So it seems the multiplexers and decoders would just take up too many pins to be worthwhile. You seem to want yet another 12 LEDs to indicate the switch to push. So this is a lot of I/O.

    http://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf

    http://www.nxp.com/documents/data_sheet/74HC_HCT165.pdf
  • PublisonPublison Posts: 12,366
    edited 2012-07-25 11:50
    Take your time to decide what you need. The BasicStamp has 16 I/O pins and a serial port for programming and debugging.

    If you use a parallel LCD, that with require 7 I/O pins minimum. A serial LCD is more expensive, but uses just 1 or 2.

    The problem with the demultiplexers is that you need two and that would require another 8 i/O pins.
    Trying to use 8 to 3bit encoders to connect 24 buttons would require another 8 to 9 pins. I had not considered a timer display.

    Obviously, you are over the 16 pin limit. So the 74595 may be a much better solution as these can be chained together and require a minimum of 2 or 3 pins.

    I suspect you will prefer a parallel LCD in 4 bit mode for 7 i/o pins and the two sets of three shift registers - one set or input and the other for LEDs, for maybe another 6 i/o. That is a total of 13 pins.

    So it seems the multiplexers and decoders would just take up too many pins to be worthwhile. You seem to want yet another 12 LEDs to indicate the switch to push. So this is a lot of I/O.

    http://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf

    Loopy,

    I don't see where he is talking about LCD's. I'm just seeing LED's in the thread.

    Jim
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-07-25 11:54
    He mentions the need for a display for timer and correct count in thread #1

    I am still trying to sort out a plan.
    Though the demultiplexers have 4 bit inputs and he physically needs two, one could be used for 16 LEDs and the second for just 8 LEDs. Together, they would take just 6 output pins, not 8. The two others could be tied to ground - just 24 outputs would be functional.

    But frankly, I haven't gotten a full count of all he needs. Are there 12 buttons or 24, and do these need to light up to indicate the correct choice.
  • PublisonPublison Posts: 12,366
    edited 2012-07-25 12:14
    He mentions the need for a display for timer and correct count in thread #1

    I am still trying to sort out a plan.
    Though the demultiplexers have 4 bit inputs and he physically needs two, one could be used for 16 LEDs and the second for just 8 LEDs. Together, they would take just 6 output pins, not 8. The two others could be tied to ground - just 24 outputs would be functional.

    But frankly, I haven't gotten a full count of all he needs. Are there 12 buttons or 24, and do these need to light up to indicate the correct choice.

    OK,

    "display the count on a meter"

    I thought that may be a one or two digit 7-segment display.

    A serial LCD may be a good option since it only uses one Pin.


  • Gunner0302Gunner0302 Posts: 12
    edited 2012-07-25 12:51
    Thank you very much for jumping in here. There are two circles with 12 LED and Buttons set in a clock face pattern. The LEDs need to light up in the same circle selected and they need to be randomly illuminated, since I am going to use this often I really don’t want a pattern developing or I will cheat. The LED can be inside the button or outside, it does not matter to me, it is whatever is easiest to get to work and since there is a total of 24 buttons on the face I am not concerned too much about the cost. The counter is to count how many illuminated buttons I push in a given time. And I can’t see there ever being a time anyone can push more than 99 in a minute, so a two digit counter would be good. Displaying the count on an LCD sound very good.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-07-25 13:01
    Are the two circles concentric, or side-by-side? 'Still trying to get a picture of what this thing will look like.

    -Phil
  • Gunner0302Gunner0302 Posts: 12
    edited 2012-07-25 13:03
    What I need this to do is randomly light a LED, whether itis inside a push button switch or next to it does not matter to me, it is whatis easiest to make. After the LED illuminates I push the button, that iscounted and another random LED illuminates, I then push that button and so onuntil a determined amount of time passes. When the time expires the number ofbuttons pushed is displayed on the LCD. Loopy thank you for your patients.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-25 13:13
    I'm still in favor of using a BS2 Stamp ... it doesn't matter which model. You'll need the serial LCD I mentioned for your display ... that's one I/O pin. You'll need 3 x 74HC595 connected in series to drive the 24 LEDs and 3 x 74HC165 connected in series to sense the 24 pushbuttons as shown on pages 130 and 134 of the StampWorks Manual. The StampWorks Manual shows 2 in series, but adding more is trivial. You just connect the additional clock and latch inputs to the same signals as the first two and you connect the third data in to the second 74HC595's data out bit just like it was done for the first two 74HC595s. The 74HC165s are cascaded similarly. The 74HC595s will need 3 I/O pins and the 74HC165s will need 3 I/O pins. That still leaves 9 for other pushbuttons used for starting the exercise and for setting the time allowed.

    The Stamps have a random number operation that provides a pseudo-random sequence of 65536 values. You can use this to select one of 24 LEDs to light and you can initialize the random number sequence based on how long it takes to push the start button (a nice truly random factor).
  • Gunner0302Gunner0302 Posts: 12
    edited 2012-07-25 13:31
    Eyes.jpg
    PhiPi, hope you can see this.
    1024 x 463 - 13K
    1024 x 463 - 16K
  • Gunner0302Gunner0302 Posts: 12
    edited 2012-07-25 13:36
    Thank you Mr. Green. I am reading that now. Would it be simpler to place the LED in the switch?
  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-25 13:48
    In most cases when an LED is built into a pushbutton, the LED and pushbutton are electrically separate. That's what I assume.

    As shown in the StampWorks chapters, you'll need series resistors for the LEDs and you'll need pullup resistors for the pushbuttons. The StampWorks Manual shows 10K pullups and 220 Ohm resistors in series with the 74HC165 input pins. The 220 Ohm resistors are optional and are for protecting the 74HC165 input pins from wiring errors.
  • Gunner0302Gunner0302 Posts: 12
    edited 2012-07-26 16:06
    I haveordered Basic Stamp PS2p24 and the SuperCarrier Board and a load of the chips you talked about. I have read most of themanuals and tutorials, I have been missing out! This is really interestingmaterial.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-26 19:40
    With 8 children, some of them could be at perfect ages to learn about robotics and microcontrollers. The Board of Education would be perfect for that along with the "What's a Microcontroller? tutorial.
Sign In or Register to comment.