I got an usual consumer alarm clock for christmas. This device had so many switches and knobs - you really had to look some things up in the maual because it was so much non-intuitive. And of course this device did not fulfill all my requirements. Originally I thought that I could use the case and the big 7 segment displays and hack the device by adding some features in form of an integrated arduino as I did in other projects before. But the human-machine-interface (HMI) was too bad because of the complex switch/knob combination.
I needed to set the alarm clock quickly (i.e. with few presses - I don't want to press a "minute button" 59 times!) but also wanted to make some settings like standard sleep duration, standard nap-time, standard volume, ... so you cannot add a rotary button for each of this settings/features. So the idea to use a touch-sensitive display came up. I also want to avoid high frequency emissions in my bedroom, so I looked for resistive (not capacitive) sensors on the screen. I found the Nextion touchscreens which have a powerful controller on it and can simply be interfaced via RX/TX communication.
There is a Nextion IDE where you can create your different screen pages by loading pictures, placing touch-sensitive areas etc. and program it. It is a little bit like the Visual Studio VB IDE, but the language has some oddities (e.g. at some places "space" is not allowed - unlike in most programming languages). Though there are examples where people developed complete games for these devices.
With help of this IDE you can place different feature "switches" on different pages which makes it really easy to integrate a lot of functionalities but keeping the overview. I am sending out different commands via RX/TX to the arduino, e.g. for "play alarm sound". You could also send data to the display if you want to do more of the SW logic inside the arduino (in a "good" programming language) and just send the results to be displayed to the screen. I started by scripting in the IDE and was amazed how easy it is and how fast you can make your steps. But with time the SW became more complex and some side-effects occurred, because the IDE and its script language is not made for complex SW. So if I started this project again I would put all the logic into the arduino.
The arduino currently just listens for commands from the screen and communicates with the sound module to start and stop playing music. As the only HW RX/TX was already in use with the screen communication I used the SW serial for this.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.