Now down to detail........................
Step 1: 'Deodorino': Amazing 'What-Is' and Amazing 'What-It-Can-Do'. Current Specifications.
MORE TO FOLLOW.....Last update Feb 1st 2019, 16:35 GMT
Read on, because although my first intention was to make an Arduino clock that flashed out the time in Morse Code, it very soon expanded to do many other interesting things too.
This 'Instructable' plots the development of the inclusion of an Arduino Pro-Mini board into an empty deodorant container (cleaned and sterilised!), hence the origin of the name 'Deodorino'.
I had lots of components salvaged from other equipment and used quite a few of these parts, but also bought some new ones along the way.
Here is the present specification of the Deodorino:
1. Boring but useful bedside lamp or torch. Uses recycled yellow LED from broken mains (UK, 240V ac) LED bulb
2. Internal vibrator. Uses tiny 3V dc vibrator motor from broken pager (before mobile phone era)
3. Fake TV. Uses RGB LED to simulate appearance of switched-on colour TV and burglar deterrent.
4. Mood lamp. Uses RGB LED driven sinusoidally and with random phase between colours.
5. Police siren. Uses piezo loudspeaker salvaged fro old PC motherboard.
6. Flashing LASER diode. Bought new, 50c. This can just flash, or you can make it send programmed Morse Code messages to the Moon. Also used to indicate a correct menu choice.
7. Flash room temperature. Uses temperature sensor, originally a salvaged LM334, but replaced with newer TMP36. Flashes in blue if below 20C, green if between 20 and 22, and red if over 22C.
8. Flash its own battery voltage, including low-battery warning.
9. Wireless vibrator alarm. Uses a 'Child-Lost' alarm bought on Ebay to use as a 'Bag-Lost' alarm; I had a habit of leaving my rucksack in cafes! As soon as I bought this my memory improved so the device was left in my junk box. The transmitter (1mW) is activated by the Deodorino, the vibrating receiver you put in your pocket, under pillow etc. Range up to 10m.
10. Flash the time in Morse Code....the original intention. It can also flash it in denary if you don't know Morse. This uses a DS1307 Real Time Clock module, $1 or less. Can also be made to flash a message of your choice.
11. Dawn alarm. Will alert you at sunrise with lights and / or sound.
12. Red and blue flashing / strobed police lamps. Another use for the RGB LED.
13. Flash sunrise time. The Deodorino is programmed with your latitude and longitude, it works out sunrise time and flashes that time out for you.
14. Flash random Morse letters and numbers. Actually, there are four options: random numbers, random letters, random alternate letters and numbers, completely random letters and numbers. Good for practicing! The speed is adjustable.
15. Adjust internal clock forward or backward one minute.
16. Flash sunset time. Similar to 13.
17. Eight hour alarm. When you press the button, the Deodorino will alert you exactly eight hours later. Based on the idea that 8 hours sleep is enough. The time is obviously adjustable if you want more or less sleep. Interesting countdown gives you something to watch if you can't sleep.
18. First light alarm. Uses a salvaged light dependent resistor to detect increasing light levels before dawn and flickers one of four LED colours to indicate the rate of increase, the colour changing every 15 minutes in the hour before sunrise.
19. Ball switch. This is incorporated but not used for much yet. I thought it might be used to quickly switch off the alarms by placing the Deodorino on its side.
20. Push button. Originally intended to use to change the program modules in action, but this idea was shelved in favour of Infra-Red control. Can be programmed by you. There is also a tiny slide-switch which is also unused so far.
21. Switch between Morse Code flashes and denary.
22. As far as possible, each module is non-blocking so you can choose to have a couple running simultaneously. For example the police siren and the police lights. Or, the 8 hour alarm plus the first-light alarm. A pin-prick sized red LED salvaged from an ink cartridge flashes every 5s to show which menu choices are active. Dim / brighter flashes indicate binary 0 /1. The sequence of flashes tells you what's active. These also act as a 'heartbeat' to show that the Deodorino is alive and responding.
23. The LASER LED is programmed to flash 3 times on receipt of a correct IR code, an 4 times for an unrecognised code.
24. When first switched on the Deodorino will flash the LASER diode 3 times, and then flash the time so you can check it against a clock.
Step 2: Deodorino Circuit and Block Diagram
The first diagram shows the simple wiring of the circuit board on the top of the Deodorino; the remainder illustrate how the various circuit modules are interconnected for the whole project.
It is possible that you might want to take advantage of making up the first circuit and use it with the relevant parts of the program, but without making a whole Deodorino.
Without infra red control the project is much simpler. Also, omitting the 'Child-Lost' system and the internal buzzer reduces the complexity considerably.
Step 3: Deodorino - Construction
The attached PDF file shows the various stages of construction including step by step photographs, how the case was cut and shaped, how the windows and window frames were made. It show testing, and eventually how to insert the circuitry into the case.....it was a tight fit!!
(The PDF file was created with LibreOffice Impress (Powerpoint equivalent), exported as a PDF)
Step 4: Deodorino - the Hydra's Head
These images show the circuit board that sits on top of the deodorant case. A small piece of 0.1" copper strip-board was used.
You can see the pins for the expansion connector.
The Arduino Pro Mini pins D11, D3, A0 and A1, GND and Vcc are connected here.
You probably know that the Hydra is a serpentine water monster in Greek and Roman mythology. For every head chopped off, the Hydra would regrow two heads; it is killed by Hercules.
Step 5: Deodorino - the IDE Used, the Program and the Libraries
Arduino IDE 1.8.5 was used for development of the program. Originally I received updates automatically for the IDE and libraries, but one update killed the program and no reason was found. This was eventually worked around by using the Classic version of the IDE, arduino-mhall119.
The latest version of the program is called 'Deodorino_2019_01_27_ACHq', and is attached here. It is not the most efficient, elegant, or compact, but it is relatively easy to understand I hope. It includes references to the majority of resources I have used and I would like to thank the developers for their time and making the information available.
The libraries (as ZIPs) need adding to the Arduino IDE by yourself.
The libraries are attached and below is a rough guide as to what they are and what they do:
MariosBlog NoDelay, Mario Avenoso of Mtech Creations, Police lights/siren. A useful non-blocking library.
TimeMaster library by Michael Margolis, from GitHub
TimeLib Needed by SetTime example sketch routines to set RTC.
Wire.h Needed for the Real Time Clock module for 2 wire communication
DS1307RTC Basic DS1307 library that returns time as a time_t UNIX 32 bit time variable
Dusk2Dawn code & library by DM Kishi
Morse library by Erik Linder SM0RVV and Mark VandeWettering K6HX modified by JZ to include adjustable LED brightness for different daylight settings and effects.
Step 6: Circuit Diagram of Hydra's Head
This forms the uppermost part of the Deodorino and comprises several simple circuits which can be built easily.
If you don't want to put all this in a deodorant case you can just pick the sections you want to use along with the appropriate parts of the program and make a simpler device.
Step 7: Deodorino. Modules Used
Images of the various extra boards and some other parts are shown here. There are 8 images and you'll probably need to click somewhere to see them all. All the images have comments on them in the white boxes.
I started with a 5v Pro Mini and apart from this type of Arduino board, a few others were needed for support, power, and programming. However, if you use a 3.3v Arduino, you will not need all of them.
Some of the newer Arduino boards have a built in FTDI so you won't need the red one. Also, you won't need the voltage level shifter as a 3.3v Arduino will drive the vibrator motor, but will need a transistor included to allow for the heavy current draw. The 3v Child-Lost transmitter draws little current and can be driven directly.