Project 1: Electronics and Software

arduino1

This part has taken me a long time, mainly because I worry too much about burning electronics and lack of resources to debug things. It also didn’t help that I kept starting and stopping work on this so it was hard to maintain continuous progress. I’d forget what it was I was doing or what I got stuck on.

Additionally, there were a lot of features I wanted to include in this that required various bits of hardware and logic to run it all. In retrospect, it would have been better to create a roadmap or outline of what I waned to accomplish, then work on individual parts and put it all together. However in some sense I thought it wouldn’t be too difficult to put it altogether in one go, so I just winged it. Working on multiple parts of the code simultaneously is not a good idea. Especially when you get bugs and have no idea where they are originating from.

Since I am writing this in post, it’s much easier for me to outline what has been done and give a proper road map of where this is going:

  1. Create time keeping electronics that display on an LCD
  2. Add LED Lamp brightness control (input from a potentiometer and create PWM output)
  3. Add alarm functionality (manual alarm set + sunrise effect for alarm action)
  4. Add button array for user input (include debouncing and UI logic)
  5. Modify firmware to be able to display time, alarm time and modify either by using button inputs (remove manual time/alarm set)
  6. Add switches to change modes (might be trouble since we’re running out of digital I/Os)
  7. Add Winamp communication functionality to buttons in different modes (media buttons, playlist selection, volume)
  8. Create script on computer to handle communication between MCU and Winamp
  9. Add an independent power supply
  10. Move all electronics to custom PCB boards or Prototyping boards
  11. Design and print an enclosure to hold all the electronics.

Steps 1-3 were fairly easy since I relied heavily on this tutorial and the RTC library. Step 4 was a bit more challenging since at first I didn’t know how to approach debouncing on multiple buttons. This changed after I resolved to use a button map and used that for checking debouncing. Subsequently, once the buttons were figured out, adding alarm functionality for step 5 was a matter of playing with the RTC library a bit more in depth.

Step 6 has been one of the more difficult challenges. I needed two switches but only had one digital I/O left. Instead I opted to use analog pins, however due to the time it takes to process the value of these pins I think I was accumulating latency and errors. Since the switches are flip/rocker switches I don’t have to worry about debouncing and don’t need to check the value as often. As far as I can tell this bug has been resolved, but more testing is needed to see if it’s been totally cleared.

Step 7 and 8 have been mostly figured out on another program. Earlier this year I was already playing with trying to make an external Winamp controller, before I changed the goal of this project to a led lamp with the same functionality. In the other program I had used an PS/2 mouse as an input, utilizing a low level serial communication to interface the two buttons and mouse wheel. A python script was already in place to handle commands from the external MCU for media control, playlist selection and volume. This project was mainly dropped because originally I wanted to display currently playing tracks on the small 2×16 character LCD. However the majority of my music is Japanese and uses many asian characters that the LCD is not able to display, making it effectively useless. With the LED Lamp however, I plan to just use the computer monitor to display this data which means I can also modify the python script as an interface for selecting playlists.

Step 9 was something I had wanted ever since I installed the LED strip. The LED strip runs at 12 V and draws about 0.5 A, while the MCU and all the electronics run at 5V with about 100mA draw. Throughout the prototyping process I have been using my Hydra which is a programmable digital power supply which was set for 5V and 12V outputs. While great for prototyping, I did not want this project dependent on it if it were to become a stand alone product. Thus, added a 9V regulator and utilized the DC input socket of the arduino. I have a 12V 1.6A switching power supply which feeds the LED strip and this small regulator which in turn powers everything else.

Step 10 is one of the slowest parts mainly because I am unsure of how to proceed. Ideally I would have liked to have a custom PCB, but it’s incredibly expensive or time consuming to manufacture a single board. Therefore I have to resort to prototyping board on which I have very limited space. On this board I need to fit the power circuit, PWM transistors circuits, a pin socket for the potentiometer, and the real-time clock circuit (in which the coin cell batter takes up a huge amount of space). The button array has already been moved to a much nicer board with fancy colorful buttons.

Step 11 I will not be able to start until the last board is finished. Otherwise I won’t know for sure the dimensions I need to fit everything in.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>