But one question, I may have observed that without the clear(), the displayed characters just create one long string, instead of refreshing the string on LCD Line #1. This continues to Line #3, then to 2, and 4. Am I wrong? or should there be a command/character to prevent it from scrolling?
Without clear(), lcd.print will print character on last used position. You shoud use lcd.setCursor( 0, 0 ) if you want to start refreshing LCD line #1.
Use couple of variables to store hour, minute, second etc. displayed on LCD. In digitalClockDisplay() add couple of conditions to see what was changed. Example:
if( secondDisplayedOnLcd != second() ) { secondDisplayedOnLcd = second(); lcd.setCursor( proper coordinates for second portion of time on LCD ); lcd.print( secondDisplayedOnLcd ); }
This way you will update only changed information on LCD - no need for delay() neither clear() in digitalClockDisplay().
Plus, in loop(), you should call digitalClockDisplay() in non-blocking manner. See example sketch for LED flasher without delay() to get idea.
Hello World! I made a short video showing basic functionality (HD on youtube site). No sound in video but there is piezo beeping when alarm is triggered on. Timing is customized for better demonstration. Don't turn of annotations to see more info.
First tap on idle panel activates given button group. Consequent taps are interpreted as commands. Alarm settings are backed up in EEPROM after each change. You can snooze alarm as many times as you want. Timeout for LED lights is indicated by very short blink in addition to visual indicator.
(I found that large LCD font on Seetron site. Hoping they do not mind using it in personal, non-commercial project.)
Frame building. The touch panel PCB is pretty ugly to be a visible interface itself. I made aluminium frame that has two basic functions - aesthetic element and an aid to hold all layers firmly closely together. There cannot be any gap between layers otherwise the capacitive touch sensing is degraded.
It is quite impossible here to buy aluminium profile I wanted (reasonable ammount for reasonable price) - U profile, 6 mm x 6 mm x 6 mm, so I bought E profile and tuned it. Resulting profile is 6 mm x 8 mm x 6 mm - two milimeters higher then planned. I am considering to hollow out the wooden shelf a little more to imbed the panel couple of milimeters deeper...
Warning: If you are not skilled in metalworking, don't try this at home.
(Click on the thumbnail to see full size.)
Step 1. Original spare E profile on left. Spit E profile into U profile and waste.
(Click on the thumbnail to see full size.)
Step 2. Four pieces to make up the frame.
(Click on the thumbnail to see full size.)
Step 3. Regular glass, 2 mm thick. Ready to cut. Used material has impact on capacitive touch sensing because of it's dielectricum constant and thickness. I tried acrylic glass as well, other thickness as well. I am happy with 2 mm glass.
(Click on the thumbnail to see full size.)
Step 4. Final glass layer to protect underlying one from scratches.
(Click on the thumbnail to see full size.)
Step 5. All parts are prepared. You can see black mask printed on transparency film. Needed to get sharp backlighted shapes. With cut hole for display to prevent unnecessary reflections. Film is protected by glass layer from previous step.
(Click on the thumbnail to see full size.)
Step 6. All frame parts sticked together using hot glue gun.
(Click on the thumbnail to see full size.)
Step 7. Final panel is 8 mm high.
(Click on the thumbnail to see full size.)
Step 8. When cutting the profiles, be precise, otherwise you get ugly looking corner joints.
I forgot to post the image. Kids were happy. It is modified bicycle rear LED flasher. Two red LEDs at back, two organge LEDs at front. Worked in -10 deg. C.
Case building. This has nothing to do with electronics but it is integral part of the project so I will document it here too.
As I wrote in the first post, there is no space beside our bed for bedside tables. Only suitable place for installation is the wall behind the headboard. Storage space provided by bedside tables will be substituted by this case - shelf. It will contain the control panel and lights as well.
Warning: If you are not skilled in woodworking, don't try this at home.
(Click on the thumbnail to see full size.)
Step 1. Two laminated chipboards, 180 cm x 20 cm in size, 1.8 mm thick each.
(Click on the thumbnail to see full size.)
Step 2. Made hole 18 cm x 12 cm to accept the touch panel. Jig saw used.
(Click on the thumbnail to see full size.)
Step 3. Made slots for lights. Plunge router with 15 mm bit used.
(Click on the thumbnail to see full size.)
Step 4. Hole outline transfered to the top board.
(Click on the thumbnail to see full size.)
Step 5. Drawn area hollowed out in top board as the touch panel is 2.5 cm thick.
(Click on the thumbnail to see full size.)
Step 6. Both boards stacked.
(Click on the thumbnail to see full size.)
Step 7. Other areas hollowed out for controller PCB and wiring.
(Click on the thumbnail to see full size.)
Step 8. Slot for controller PCB on the right side.
(Click on the thumbnail to see full size.)
Step 9. Both boards sticked together.
(Click on the thumbnail to see full size.)
Step 10. All four edges aligned by cutting few millimeters. Circular saw used.
(Click on the thumbnail to see full size.)
Step 11. Rounded two edges - safety meassure and aesthetic design.
(Click on the thumbnail to see full size.)
Step 12. Prepared aluminium profiles and plastic diffusers.
(Click on the thumbnail to see full size.)
Step 13. Applied ABS edge.
(Click on the thumbnail to see full size.)
Step 14. Imbeded aliminium profile with sticked LED strip.