Section 3 - Install the Arduino software
After having built your PCB board, you need to install the Toolkit Arduino Software to your Arduino. You can use either the Arduino IDE or any other IDE. In the following we will show you how to do it with the Baeyens Arduino Eclipse IDE and with the Arduino IDE.
Baeyens Arduino Eclipse IDE
Visit the following page to get an Eclipse IDE with Arduino integration. It is ready to use and works for Windows, MAC and Linux: Arduino Eclipse IDE
Click on the "Install" tab on the main page. Click under the "Stable" section on your operating system.
Download the desired Eclipse version (32bit or 64bit).
Unpack Eclipse and start it. Then it will download some resources, which takes some time. When Eclipse is started create a new Arduino project on "File->New->New Arduino sketch".
Follow the dialog to create an empty project. Enter a name for your project. In the example it is "LetYourBodyMoveToolkitArduinoSoftware". Click on next.
Now select the type of your Arduino, the port and the processor. For the control module we used an "Arduino Nano" foodprint. Select "Arduino Nano" as board and "ATmega328" as processor. Select the port which corresponds to your Arduino nano. Click on next.
Select Default .ino file in this step and press finish.
Your project should now be located in the left tab.
On the top level you will find a samle .ino file. Delete this .ino file and copy all files from the "letyourbodymove\ToolKit\ArduinoSoftware" into the your root project folder.
Select your project and click on "Arduino->verify". The project should compile. You should see something like the following:
Now make sure that you connected your Arduino nano to your pc and it has the correct port. Click on "Arduino->Upload Sketch". The code will be uploaded to your nano. During this process the LEDs of your Arduino are blinking.
If this goes wrong you mind need to check if you used the right USB port. You find the setting when you make right click on your project folder then preferences and go to the Arduino tab.
Test to run a the blink sample from the Arduino page. The Port 13 is usually connected to one of the LED on the Arduino.
Install Arduino IDE
Read the Getting started with Arduino if you are new with Arduino. It inclused a step-by-step installation tutorial corresponding to your operating system.
Connect your Arduino Nano with your PC, start the Arduino IDE and test your installation with the "Blink" Sketch from Arduino ("File/Examples/01.Basics/Blink").
Upload the program to your Arduino
Start the Arduino IDE and open "<your created folder>\ToolKit\ArduinoSoftware_Arduino_IDE\ArduinoSoftware_Arduino_IDE.ino". Connect your Arduino Nano over USB to your PC.
... //the string below is how your EMS module will show up for other BLE devices #define EMS_BLUETOOTH_ID "<your-device-name>" //Change <your-device-name> to a name you like. Use only [A-Z0-9] and a maximum of 20 characters. ...
Load the Software up to your Arduino. Do not interrupt the process.
Test the Toolkit
Listen to the COM Port of your Arduino. Open the Serial Monitor in your Arduino IDE ("Tools/Serial Monitor") or any other Program you like to use. Use 19200 bauds.
You will see something like this:
SETUP START RESET DONE Set Baudrate: <- is ok Reboot?: <- is ok Version: ERR <- is ok Set Name: AOK <- Bluetooth name is set. This and all following should show AOK. If not check the connection between the RN4020 and the Arduino. Set peripheral mode: AOK Enable private services: AOK Clear private services:AOK Set new private service: AOK Set new private service value: AOK Set Baudrate: AOK Reboot?: Reboot INIT DONE Setup DONE
After this initialization the orange LED on the Arduino should glow. If all commands except the first are AOK the Module is ready to listen to your commands.
Now you can test the toolkit with your Keyboard. Set the line ending in your Serial monitor to "No line ending". Key '1' activates channel 1. The green LED should glow. Key '2' activates channel 2, the red LED should glow. Another hit on '1' or '2' deactivates the channel.
After checking that your LEDs work, measure the resistance with an ohmmeter between the two output pins for one channel on the Toolkit.
You should measure no connection or very high resistance if the corresponding channel is inactive and a low resistance about 50 Ohm if the channel ist on. The measured resistance is composed of 2 x resistance of Optocoppler a 25 Ohm and the resistance of the MOSFets.
The MOSFets are in parallel with the electrodes, so they represent a current divider with the electrodes. A High MOSFet resistance causes more current through the electrodes and therefore a higher intensity of the felt signal. A low MOSFet resistance causes more current throug the MOSFets and less current throug the electrodes. The resistance of the MOSFets can decrease nearly to zero so you will feel no current flow through your arm, because all current flows through the MOSFets.
The digital potentiometer is the "AD5252", the MOSFets are the two "25NF20", which are in parallel with the elcectrodes and the EMS-signal generator.
The resistance of the MOSFets is controlled via a digital potentiometer. It has 256 steps. The value 255 means no intensity on your arm because the mosfets get full power and open completly as described above.The resistance decreases to nearly zero and all current flows throug the open mosfets. The value 0 will bring the MOSFets to a resistance in MOhm region. So all current will directed throug the electrodes and you will feel an high intensity.
To test this circuit, test the response of the digital potentiometer first. For activation and deactivation of the channels, the following keys are defined:
The key 'w' decreases the Poti Value for channel 1, 'q' increases the value. You should see something like this:
Poti value on channel 1: 129 Poti value on channel 1: 130
The same is implemented for channel 2 with 'r' and 'e'. If the value does not change, check the connections between the digital potentiometer and the Arduino. Do this also if the Arduino blocks and only prints to a specific line numer in the code. The used library for the communication with the potentiometer can block the execution of code if there is no response.
To test if the resistance changes you can also measure it with an ohmmeter between two pins on the input side for the corresponding channel.
If the resistance changes as described above (high poti value = low resistance (~ 0 Ohm) , low poti value = high resistance (~1,5Ohm)) your Toolkit should work properly.
If this does not work, check if you soldered all components correctly and if there are no interconnections between pins which should not be connected.
|Back to section 2||Back to Home||Continue with section 4|