Having successfully created my own 4 x 4 LEDGrid display using some green LEDs generously donated to me by Element14 recently (LEDGrid Display #1 : First Working Display ) I decided to try for a double lot of photons for the Photonics Project14 Challenge by including a laser activated option. This uses a LDR to detect a bright light, so a laser is ideal and then changes the display to identify this. The four centre LEDs are on when no laser is detected to form an aiming target for the laser. Then when the laser light is detected the inner four LEDs go off and the outer sqaure of 12 LEDs come on to show the target has been 'hit'. The video below shows the system in operation.
The circuit is only slightly different from that illustrated in Part 1 and just adds the LDR. I used a value of only 1kOhm for the bias resistor for the LED (which has a dark resistance of about 4 - 5 kOhm and laser light resistance of approximately 200-300 Ohm) to get a good change in voltage when illuminated by the laser. This also has the effect that the system works well even in bright light.
I improved the programme a little bit and used functions to display the two squarea, innersquare() and outersquare() using a global variable for the LED grid for this rather than passing in the values in order to save time on pushing all the values onto the stack and then popping them off again. I haven't performed any measurements of the time taken to manipulate the LED grid data compared with the ON time but with a 1:16 multiplexed display ON rate, the LEDs are already dim so any time saving is worthwhile.
LDRvalue = analogRead(LDR);
if (LDRvalue < 250)
}/* if */
for (indexY = 0; indexY < 4; indexY++)
digitalWrite(A2 + indexY, LOW);
for (indexX = 0; indexX < 4; indexX++)
} /* for */
digitalWrite(A2 + indexY, HIGH);
} /* for */
With this arrangement I have achieved some animation of the display by just alternating between the inner square being on and outer square off (no laser) and the inner square being off and the outer square being on (laser on the LDR). The data displayed is hardwired into the programme so at present this is not a particularly good general purpose solution, but it works for this application.
I have added a second 3D printed part, a backplate that holds a white breadboard containing the Nano. The protoboard is an interference fit into the backplate which I was pleased worked, so that no additional gluing or fixing is needed, see below, which is a screen shot taken from the 3D printer software. Then with the addition of some brass spacer pillars a relatively compact module has been created. I didn't think enough about the storing the wiring within the module (actually I didn't think at all about this) so it spills out the sides and makes it look messy. Still, the structure is mostly solid and compact so maybe for the next project I will remember to allow space for wiring. Plus, the battery pack is just Bluetaced to the backplate and there isn't an ON/OFF switch. Also things for future projects.
I have tried the display and laser outside at night and it works quite well and the laser will activated the display at distances up to approximately 10 m. At this point the laser beam becomes too spread out (this is a safety feature of the laser) to be detected with the current threshold. There isn't a video of this as my camera just captured a lot of darkness. I am sure that with a little more tweaking it would be possible to achieve even greater distances. It is difficult to maintain the laser dot on the target area, especially at a distance so it could probably do with some form of display latching to show a 'hit'. Then, with the addition of some sort of momentary activation of the laser a simple 'shooting gallery' game could be created.