This section discusses the underlying concepts for the multi-switch method and develops the equations required for stand-alone calculation of unique identifiers for each of the 16 possible dip switch setting configurations. Play melody as driven by the application via the Arduino tone function An alternative is to find a dip switch that is truly made for breadboard use with regular IC pins. A socket helps to make the connection more solid. The posts on most dip switches do not hold the switch very well in a breadboard. The socket stabilizes the dip switch connections and keeps the switch from being easily lifted when setting the toggle switches. Optionally, depending on the type of dip switch used, it is helpful to use a 2x4 8 pin socket to connect the dip switch to the breadboard since the standard dip switch pins seem to made for soldering to a perfboard not plugging directly into a breadboard. A piezo buzzer is added to the configuration for implementation of the music box tune selector. Implementation of the multi-switch input method requires only a 4-pin dip switch, the 5 resistors used for the voltage divider, and hookup wire for connections. Use of the UNO as the implementation platform minimizes the number of required hardware components. The selected melody is then played through a piezo buzzer using the Arduino tone function. This instructable employs the multi-switch method to implement tune selection for the music box application. This set of 16 integer identifiers is then used in the application program to associate an action with a setting. The multi-switch 1-input technique uses a Voltage Divider circuit to provide a unique integer value for each of the 16 possible switch setting combinations. Fortunately, I ran into an article which describes an ingenious method for using 1 analog pin to handle multiple switch inputs. Since I was planning to use the ATtiny85 for development, loss of 4 pins was a bit too much. However, the brute force implementation for this approach requires 4 device pins, one for each switch. A natural choice for picking a specific tune was a 4 pin dip switch since 4 switches provides 2 4=16 different settings. A while back I worked on a "music box" project that needed to choose between as many as 10 different tune snippets.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |