In my previous post I described the resources available in the wiring box where myDoorbell will be installed. As illustrated in the following figure, the available resources consist of a 16 Volt AC source and a connection to a doorbell button with an integrated lamp.
When the button is pressed, approximately 1 Ampere of current flows through the circuit. This current at 16 Volts AC yields 16 Watts of available power (16 Volts * 1 Ampere). This is sufficient for anything I am envisioning. For a more thorough, yet simple, explanation of Ohm’s Law click here.
Features and Hindsight
As pointed out in my first post on this subject, myDoorbell will have several unique characteristics or features:
- Play ringtones uploaded by the user to celebrate seasons, holidays, birthdays, etc.
- Record the time and date of each ring
- Be configurable
- Send a text message indicating a ring, if configured to do so
- Be silent if configured not to make noise when babies are sleeping, pets shouldn’t be disturbed, or the owner just doesn’t want to know visitors are present
- Access other Web resources such as APIs, webhooks, etc.
As the saying goes, hindsight is 20/20. If I were designing myDoorbell all over again, I actually am, the next thing I would do is design the API that would describe the HTTP resources, methods, and error codes used to implement the above features and behaviors. However, when I began this adventure I didn’t know much about APIs, HTTP, and related technologies. Recall that this lack of knowledge was precisely why I started this adventure.
I will proceed in roughly the order I actually took, but want to encourage any readers creating hardware or software systems that they should design the API first. Since software is eating the world it is clear that any real system will contain software, and I believe that all such systems should have an API. Creating the API first will result in a better product and will reduce the risk of cresting hardware and software components that in the end are unnecessary.
Several hardware and software components are necessary to implement the characteristics and features listed above:
- myDoorbell needs Internet connectivity to facilitate the uploading of ringtones, to enable the calling of other APIs or to raise events, and allow the acquisition of configuration information and updates. Since there is no wired network connection in the doorbell wiring box, this connectivity will be provided by a WiFi module.
- A microcontroller is needed to interact with the WiFi module, provide a compute platform for the web server implementing the myDoorbell API, interface with a nonvolatile memory, and enable the detection of the state of the doorbell button.
- A software module is needed that time slices between detecting the state of the doorbell button and dealing with incoming network traffic. It must also copy incoming ringtone data to the nonvolatile memory. Finally, this module must implement outgoing requests and the raising of events.
- A simple hardware module is needed to provide doorbell button state information to the processor.
- A nonvolatile memory is needed to store ringtones and configuration data. This memory needs to be writable by one microcontroller and readable by another, two ported.
- A second microcontroller is needed to copy ringtone data from the nonvolatile memory to the audio system.
- An audio subsystem is necessary that converts mp3 encoded music to audio and amplifies the resulting audio to a sufficient amplitude to drive a speaker to the required volume.
- A power supply is needed to convert the 16 Volt AC to a 3.3 – 5 Volt DC source for the digital electronics and a higher DC source for the audio amplifier.
The following figure is a block diagram illustrating the hardware components listed above. Note that there are two modules for detecting the doorbell button state because most commercially available doorbells have the capability of ringing for both a front and rear door.
There are of course many ways to design any system, and I am not arguing that this is the best or even a reasonable design. In addition, as technology changes so do the choices and possible optimizations. My intent was to learn, and I learned a lot. In my next post I will describe the power supply module. This seems simple, but hang on and keep your arms and hands in the ride at all times!