~ Project Pages and Instructions ~
ARDUINO IDE
The Arduino IDE is a piece of software that you will need to install on a home computer so that you can modify the sketch to fit your environment and then upload it to your chosen Arduino compatible MCU. You can obtain it from the Arduino website by going to Software > Downloads and downloading the current version of the IDE that will run on your computer. Install it per the instructions there and launch it.
CONNECT YOUR MCU
This is where it starts to get fun. Using the correct USB cable for your MCU, plug in the cable to a USB port on your computer and to the programming port on your MCU (not one of the X,Y,Z, or W ports) and your computer should make a little sound indicating that something has been connected. If you don't hear anything it is most likely because you have your volume turned down, or you have peanut butter in your ears. Depending on your operating system and version, you may see a message about installing drivers for the device. Select 'Yes' so that the drivers get installed.
SET PORT
Anything worthwhile requires a little effort on your part, and yes, it seems like it never ends! Think positive, we are getting closer to our goal with each step!
In the Arduino IDE, click on 'Tools' then hover the mouse over 'Port' and find the COM port that lists your MCU. Click on that port to set it.
SET BOARD TYPE
Next you will need to set your Arduino board type in the IDE software.
Launch the Arduino IDE
Click on 'Tools'
Hover the mouse over 'Board:' in the drop down menu.
Select the board you are using from the list. If you are using a Sparkfun Redboard, select "Arduino Uno"
LOAD THE SKETCH
The easiest way to do this is simply browse to the location on your computer where you saved the sketch downloaded from our Downloads page. Find the file, and double click on it. The Arduino IDE will launch followed by this message:
Click the 'OK' button and the folder will be created. The sketch will then open in the IDE.
Scroll down in the sketch to the lines shown in this screenshot. Click on the thumbnail for the full sized view which opens in a new window. Close that window when finished.
There are a few settings in the sketch that each
user will have to verify or change in order for the program to output the
correct value to TouchDRO. There are only a handful, and they are very easy to
change.
Note that you must know what version your scales are. Instructions for
determining your scale versions can be found on the 'Basics'
page. You should have made that nice little chart which gives you your versions
based on the 'Assumptive Method'. You will need to modify the sketch to make
sure that the version settings match what you have in your chart.
In the sketch, the X axis is always enabled, no matter
what value you have for the X_ENABLED statement. TouchDRO always expects to have
at least that one axis connected. That particular line is in there to
make all of the axis settings look the same.
Second, these are true/false settings. A 1 means
True, a 0 means false.
The User Settings
section is at the very top of the program. It consists of 2 settings for each
axis, an ENABLED setting to tell the sketch if you actually have a scale
connected to that port, and a Version setting to tell the sketch which version
of the scale you have on that port. Every setting starts with the
#define
directive, and is then followed by the axis
letter and setting name. That is followed by a 1 or a 0 to tell the sketch if
that particular setting is true or false. There are only 9 User settings to
make, so it’s pretty quick.
The default settings of the sketch are: X axis
connected and it’s version 4.3, Y axis connected and it’s version 3.1, Z axis
connected and it’s version 3.1, W axis NOT connected and it’s version 3.1. The
last setting, BT_BAUD, tells the Arduino what speed to send data to the
Bluetooth module. The default setting is 9600 which is the default baud rate
most BT modules are set at from the factory. If you have re-programmed your
module to communicate over the RXD pin at a different rate, this is where you
put that value.
Now for some examples:
If your X axis is version 3.1, make this change:
Change this:
#define
X_VER_31
0
the default setting is that the X axis is
version 4.3.
to this:
#define
X_VER_31
1
If you do NOT have a Z axis connected, make this change:
Change this:
#define
Z_ENABLED
1
the default setting is that the Z axis is
enabled.
to this:
#define
Z_ENABLED
0
The last setting, #define BT_BAUD 9600, is for people who have reprogrammed their Bluetooth module. If you know how to do that, then you know what value this should be changed to. Otherwise, just leave this number alone.
You can change the name or the baud rate of your Bluetooth HC-05 card if you wish, but doing so is way beyond the scope of this project. A quick search on the Internet will garner an entire list of documents and YouTube videos that will teach you how to make those changes using +AT commands. Just remember that if you change the baud rate (totally unnecessary) on your Bluetooth card, you will also need to change it in your sketch. We recommend that you leave the baud rate set at the default of 9600. Changing the name of your Bluetooth card affects only the card, and is simply a convenience item when connecting to it from your Android device. Just be aware that we do not support these steps as they are unnecessary and, as said earlier, beyond the scope of this project.
SAVE YOUR SKETCH
Don't forget this part, or you'll want to kick yourself in the posterior. Save your changes by clicking on the downward pointing arrow.
UPLOAD SKETCH TO THE MCU
You will now need your MCU and a proper USB cable for your board. If you have an Arduino Uno board, you will need a standard USB-A to USB-B cord. If you purchased a Sparkfun Redboard you will need a cord with a standard USB-A to USB mini-B cord which you must purchase separately. Other boards, which were not tested, may have other requirements.
Connect the proper cord to your computer and to the programming port on the MCU. There is no need to provide power from a wall wart to the MCU for this step.
Windows should automatically recognize that a new device has been connected and may want to install the drivers for it. Be sure to allow it to do so.
Upload the sketch to the MCU by clicking on the
Upload button.
When the upload completes, a green LED will flash on the MCU then stay on steady.
You may now close the Arduino IDE and disconnect the MCU from your computer. It is NOT necessary to use the Windows 'Eject Device' tool, simply unplug your device.
Move on to the next step: 6. "Test & Calibrate"
Page updated on Sunday, December 27, 2020