Menu

Lightswitch Controller

David McGinnis Kyle
Attachments
AssembledFlipper.JPG (522234 bytes)
LightSwitchFiles.zip (23421 bytes)

Overview

The lightswitch controller is an IO Interface that implements ILightSwitchController. The lightswitch controller is designed to be used with the Arduino light switch flipper. It communicates with SAMI using an XBee Series 1 module.

The Hardware

The light switch flipper is designed to fit in over existing light switches, and also allow the switch to be manually toggled if necessary.

The attached zip file includes .stl files for printing the flipper. These include the main base, flipper, and servo mounts (you'll need two of these). This can be assembled as shown below:

The servo mounts will need to be glued into the base. The holes in the base for the mounts are somewhat loose so any standard sized servo such as this should fit. The servo can then be attached to the flipper with a paper clip or a thick study wire. Be sure to make the wire the right size so that when the servo is in its mid-point position, the flipper is in its mid-point position and allows the switch to be flipped freely between on and off.

Modifying the Arduino code

The arduino code provided is a good starting point, but it probably will not cover everyone's needs. The code can be modified to meet these extra needs.

The code is set to have 3 servos connected to it, one on pin 9, 6, and 5. The pin numbers can be changed if necessary by changing the appropriate pinNumbers[] assignment in setup(). In addition, more servos can be added by changing servoCount to the new number, and adding in additional pinNumbers assignments. Remember that servos need to be connected to PWM capable pins on the Arduino. The servo on, off, and middle positions can be changed in the setup() function too.

Configuration File Format

<lightswitch room="Living Room" xbeeid="13A20040A581DD" name="Living Room Light" type="Light" servoid="1"></lightswitch>

Room: The room which the switch is located in.
XBeeId: The serial number of the XBee connected to the Arduino
Name: The name of the switch. This is used in the app to reference the light.
Type: Indicates what the switch is connected to. Can be "Light", "Fan", or "Outlet".
ServoId: The servo index that switch is connected to. This is not the pin which the servo is connected to, instead it is the index in the arrays which store info about this switch.

If you have multiple light switches connected to the same arduino, add multiple LightSwitch tags to the configuration file. Each will have the same XBeeId, but with their respective ServoIds.

First-party App Support

This IO Interface is used by the Light Switch app.


Related

Documentation: First-party Apps
Documentation: Light Switch App

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.