Alternate Switch Control Interface, With USB Cable and Bluetooth Connection Modes

by SparksEngineer in Circuits > Assistive Tech

135 Views, 2 Favorites, 0 Comments

Alternate Switch Control Interface, With USB Cable and Bluetooth Connection Modes

Overview.png

This instructable aims to explain in detail how to recreate the“Alternate Switch Control Interface'' Product. This product was designed for people with physical disabilities who use the Switch Control accessibility feature with an External Adaptive Switch, as a means to use their electronic devices.

It provides them with a tool that allows universal use of their “External Adaptive Switch” with any smart electronic devices such as smartphones, tablets, computers, and any other electronic devices that have the Switch Control program feature available. The users will be able to connect their External Adaptive Switch” through either wireless Bluetooth or a USB cable and adapter if necessary.

To understand better how to use this product download the User manual below.

Supplies

Circuit Design

2021-04-08_verP_Adafruit_Feather_pcb.png
PCBfile_for_The_Alternate_Switch_Control_Interface_bb.png
PCBfile_for_The_Alternate_Switch_Control_Interface_schem.png

Here you may see the Circuitry of our project:

It has all the connections seen in the breadboard PCB design later. Below is the Fritzing file, and you can export the Gerber Files if you want to order this PCB. Also check out the files in the github link if you want all of the most updated files.

Programing Adafruit Feather 32u4 With Arduino IDE

Preferences window.png
DIY_adafruit_products.png
microcomputers_featherselect.gif

Since the Adafruit Feather 32u4 uses an ATmega32u4 chip running at 8 MHz (similarly to Arduino boards), we can program the microcontroller using the Arduino IDE. Before we program the Adafruit Feather with the Arduino IDE follow the following steps to set up for programming the board.

Steps to setting Arduino IDE:

  1. Download the Arduino IDE program from https://www.arduino.cc/en/software. Follow the instructions on the site/.
  2. Once you have downloaded and opened the latest version of Arduino IDE go to File > Preferences.
  3. Once the “Preferences” window appears, copy and paste the link “https://adafruit.github.io/arduino-board-index/package_adafruit_index.json” in the box next to “Additional Boards Manager URLs”, as shown in the image.

The list of URLs is comma-separated, and you will only have to add each URL once. Any new Adafruit boards and updates to existing boards will automatically be picked up by the Board Manager each time it is opened.

  1. Now in the Arduino IDE, go to Tools > Board: “...” > Board Manager... > In Type, Select Contributed > Then Install “Adafruit AVR Boards”.
  2. Close and then reopen Arduino IDE, to ensure that all of the boards are properly installed
  3. In Arduino IDE > Go to Tools > Board: “...” > now you should have the Adafruit Boards option > Select Adafruit Feather 32u4.
  4. Now connect the Adafruit Feather 32u4 via USB to your computer. It should be blinking lights to show you that it is powered ON.
  5. In Arduino IDE > Go to Tools > Port > Select the Port on your computer where the Adafruit Feather 32u4 is connected to.
  6. To download the necessary Library, in Arduino IDE > Go to Sketch > Include Library > Manage Libraries > search “Adafruit Bluefruit nRF51” > Install. Now your Adafruit should be ready to install our provided code below. For more information, or problems encountered, with the provided steps please visit the following links provided by Adafruit:

Microcontroller Code

Edited _Short Flowcharts-  ModeSwitch system.jpg
Edited _Short Flowcharts- Burron_System.jpg
JT edited _Short Flowcharts_ - Battery Status.jpg

Although the final program is available for download let's explain how it works. Below are some flow charts for the program developed for this product. The program will send either a “w” key press or a spacebar key press depending on which switch (button or external adaptive switch plugged into one of the connectors) is activated, and for how long.

In the main program, the “Mode Switch” seen in the electrical design, is used to select between Bluetooth® connectivity mode (“BLE Mode” or Mode 1), “USB mode” (or Mode 2), and lastly “Battery Mode” (Mode 0) which is currently used to state the status of the 3.7v battery.

In our electrical design and program “BLE Mode” is selected when digital pin 12 is “HIGH”/ “ON” (the switch is set to the leftmost position), “USB Mode” is selected when digital pin 11 is “HIGH”/ “ON” (the switch is set to the rightmost position), and Mode 0 (for Battery mode) is selected when digital pin 12 and pin 11 are both “LOW”/ “OFF” (switch is centered).

When “BLE Mode” (Bluetooth® connectivity Mode) is selected the product will send the keyboard signals to a Bluetooth® paired device. In USB Mode the product will send the respective “w” or spacebar key keyboard signals through a USB cable. The “Battery Mode” currently will verify the voltage value of the battery every 2 seconds, and will only turn on the Red LED (“LED 2”) if it's lower than 25% of the capacity, and the Green LED (LED 1 in the PCB design) will turn on if it's higher than 25%.

Note that the battery used for building this project was a Nickel–Cadmium battery of 3.7v and 1000mAh. This battery typical life ranges from 4.2v - 2.8v, but if the voltage drops from 3.2 the Adafruit protection circuitry cuts off the battery power. [Source] As such since the battery voltage can range by 1.0v we decided to specify the threshold voltage value as 3.45v (25% of battery is 3.2v + 0.25v), but this value may differ if using a different type of battery.

As previously mentioned, every time one of the buttons is pressed (or the external adaptive switch is used) then the Green LED will turn on and the respective keyboard key will be pressed but not released. Once the button is released (or the user stopped pressing their adaptive switch) then the Green LED will turn off and the keyboard key will be released. The “button is still pressed?” loop is necessary to simulate a “long press” which is comonly used to activate a different function in their devices like a return to home.

The Arduino IDE code can be downloaded below, but make sure to save both the "BluefruitConfig.h" and "Program-The_Alternate_Switch_Control_Interface_Device.ino" files in a folder named "Program-The_Alternate_Switch_Control_Interface_Device".

Setting Up the Slicer Program

The software used to print the 3D model  in the 3D printer.png
Picture2 The creality CR-10 mini printer.png
pic3 USB adapter for the the sd card.png
Picture4The settings to set  the printer.png
Figure 5 The preferences to add- Remove printers.png
Picture6 Were to add your printer.png

First

you will need to download a slicer to send the .STL files to the 3D printer as gcode file. We suggest you download the slicer software used in this project, which was the ultimaker cura version 4.8.0: https://ultimaker.com/software/ultimaker-cura.

The 3D printer used to print out the 3D models was a “Creality CR-10 mini”

In order to add the 3D print files to your printer, you need to save the gcode file generated by the slicer (in this case cura). After having that and saving the gcode file you can start printing with your 3D printer. You must also verify that the 3D printer has a slot where you can place the sd card in order to print your models. There are some 3D printer models that do not require the sd card, if so you can go straight to setting up the software on the next step.

Once you have the software, if you do not have the printer set up in the software, you can manually add your printer by going to settings>Printer>"Manage Printers...".

Once the "Preferences" window appears you can add or remove 3D printers in the software. This is important because it will simulate the size of the printer, and will be able to warn you if the object is can be printed on your desired printer. Once you click the "Add" button in the "Printers" tab, this will install the library to add all printers or to custom make a non registered printer.

Print Settings

Picture7 The print settings.png

Once you have downloaded the files for your printer and set everything up, you must specify the setting for printing the objects in print settings:

As seen in the picture provided for the "print settings" window, it is suggested to place the profile as a Super Quality - 0.12 mm. This will help make the 3D print stronger and precise. As you can see the layer height is at 0.12 mm because of the quality however this will make the 3D print to print longer since it will give the more precise model.

Setting the Shell

Picture8 Setting the infill and temperature for the material.png

The next settings for the printer is the Shell:

● As seen before, use the wall thickness of 1.2 mm

● Wall line count at 3

● The top/bottom thickness you can use 0.84 mm

● The top thickness 0.84 mm

● The Top layer will be 0

● As for the bottom layers we used 999999

● Horizontal Expansion 0 mm

Once you have placed all the settings as seen in the provided photo it is important to set how the 3D printer will print the material. As you can see on the infill, this will make sure how much of the PLA or ABS plastic material will be used on the model. We used 100% to make the print solid. If you decrease the infill, this will make the object hollow.

As for setting the temperature of the material, this is important. Since each PLA or ABS has different suggested temperatures on the material. For the PLA that was used for our print, the optimal temperature was 205 celsius. However, used 50 celsius for the hotbed but you can increase the temperature to 60 if desired.

Settings for Speed, Travel, Cooling and Supports

Picture19 Setting speed .png

These will be the last settings for the printer, here you can see the following:

  • Speed: Here is important information, this will set up how much speed the printer will make. If you add more velocity this will not make the 3D model precise. The lower the speed the more detailed and precise the model will be, for out print a speed of 60 mm/s as used.
  • Travel: For the travel section we enabled retraction
  • Cooling: It is important to to enable print cooling and set it to 100 % the fan speed to make sure you protect your printer once it is done and to not overheat the print
  • Support: It is recommended to add support on you model to help the model print as desired
  • Build Plate Adhesion: It is recommended to add a Brim adhesion, which will help to remove the model on the plate more easily.

Once you are done with all the settings, you can now place the STL files provided. Check the print time, save the model gcode on the USB, and you will be able to print the 3D models on the 3D printer.

Picture17 the switch extende.png
Picture18 spacer.png
Picture15 Button Extender.png

As you can see, besides the main the box and lid for the product, thre are a few other components that will help complete the printed product. The "button extender" will need to be placed on the buttons on the PCB. Once the model is 3D printed, sand it well so it can move smoothly once the lid is on.

Then there is the "switch extender" for the "mode switch", this component is to help extend that switch(as the anme implies). However, with this design, you will need to apply a little pressure in order to move the switch once the lid is on the box.

Lastly we have the spacers which help to make sure that the PCB will not touch the bottom of the box. However, there are 2 different versions. The bigger spacer will go on the front, where the LEDs, power switch, and input jacks are located. Since this section of the box requires to elevate the PCB a bit more, because of the design of the box. The smaller spacers will be located where the microcontroller (and most importantly the USB port) is.

You can download the stl files for these components and the main box below.