Brick Controller Setup
Figure
1: Main screen
Figure 1 shows the Main screen and the controls that are available. The Main screen allows direct control of the four motors and the four LEDs. The individual menu items are described below.
Script. This will display a new window where the script can be entered in. See the description or the Script window below.
Options. The following options are available.
API Level – This will return the current USB API level.
Factory Reset – This will erase the entire internal FLASH memory and reload all the factory default settings.
Firmware Update – This will put the module in the firmware update mode. See description of the Upgrade process below. Any stored script will be erased.
Figure
2: Script Screen
Figure 2 shows the window where the script is entered. For an explanation on script entry and usage, see Using Scripts below. The individual items are described below.
Motor Control – allows the user to select the state of the motor.
LED Control – allows the user to select the state of the LED.
Instruction – allows the user to select the type of script command to be executed.
Motor/LED indicates that the script command will change the state of Motors and/or LEDs.
Wait Event allows the user to wait on an event, either BT control or sensor input.
Reset Script will cause the script execution to jump back to the first script command and resume execution there.
Stop Script will cause the script to halt execution
Time – this the time (since the script started running) that this script command will be executed. Resolution is 100msec or 0.1 sec.
Next Button – this will move the script editor to the next script command. If the button is grayed out, then the editor is at the last script command.
Previous Button – this will move the script editor to the previous command. If the button is grayed out, then the editor is at the first script command.
Insert After button – this will insert a blank script command after the current script command.
Delete Button – this will delete the current script command.
Status Information – this area shows the line number of the current script command, the total number of commands in the script and the amount script storage memory available.
The Script Action menu provides the following functionality.
Store – this will store the current script on the Brick Controller internal memory.
Retrieve – this will retrieve a script from the internal memory on the Brick Controller.
Save – this will store the current script on the PC. The normal Windows SAVE Dialog box will appear for you to select a file name and location. The file extension for all scripts is .spt.
Load – this will load a script from the PC. The normal Windows LOAD dialog box will appear for you to select a file name and location. The file extension for all scripts is .spt.
Clear – this will clear the script in the PC memory. It will have no effect on the internal memory of the Brick Controller.
Start – this start the execution of the script stored in the internal memory of the Brick Controller.
NOTE
Using this command may or may not execute the script in PC memory, if a STORE command had not been executed prior to using this command.
How to use the Brick Controller
The Brick Controller will control up to 4 independent motor and four independent LED type devices. The Brick Controller can be controlled by either a PC through the USB connector or across the Blutetooth LE interface. Available controls are
Motor On or Off
Motor Forward or Reverse – these are momentary contact switches
LED Off, On, Burst, Cycle or Pulse
NOTE
When using the Motor On/Off button, the direction used last is the direction the motor will run.
The PC interface can be used to enter a Script. Once a script is constructed, it can either be saved on the PC or stored in the connected brick controller. It is highly recommended to save all scripts on the PC, since no save feature is available on the Android Application.
Brick Controller Status LEDs
These are the two LEDs to the right of the Bluetooth Device labeled L1 and L2. There are 3 possible states and they are indicated by the blue and yellow LEDs on the side next to the button as shown in this table.
State |
Blue LED |
Yellow LED |
Connected to and recognized by the PC (Power) |
Flashing |
ON |
Standalone |
OFF |
ON |
Standalone and script running |
ON |
Flashing |
Bluetooth Status LEDs
These are the three LEDs to the left of the Bluetooth Device. These LEDs have two functions. They indicate the state of the Bluetooth connection or can be controlled by the firmware. Once they are controlled by the firmware, they will no longer indicate the state of the Bluetooth connection until the power is cycled or the connection is broken. The table below shows meaning of the different states.
State |
Blue LED |
Red LED |
Green LED |
Power applied to BT module |
ON |
N/A |
N/A |
Connected to another BT device |
ON |
N/A |
ON |
RED Option selected on Android Application |
N/A |
On |
N/A |
Using Scripts
Scripts are a set of time sequenced commands. When entering a script, at each time interval (0.1 sec resolution) you indicate what action should happen. For example
at 1.0 seconds Motor 2 begins running in reverse
at 2.3 seconds LED3 turns on, Motor 1begins running in forward
at 5.2 seconds LED3 turns off
at 7.5 seconds Motor2 begins running in forward, Motor 1 stops
at 11.0 seconds Motor2 stops
at 11.5 seconds the script stops
Once the script is entered into the PC, it must be stored in the Brick Controller by using the Store option on the Script Action menu. Scripts can also be stored on the PC by using the Save option.
Controlling the LEDs beyond Off/On requires some thought. The Burst mode will last 5 seconds and the Cycle mode will last 16 seconds. Changing the mode prior to this could cause unpredictable results for that LED. The Pulse mode will continue until the LED is turned off. It is only available on LED3.
Wait event instruction will cause the script to halt until either the BT LED is turned on by the Android application or the sensor input is at the high voltage input, depending on which one is selected. In this case the event is in the TRUE state. If the BT LED is off or the sensor input is at ground, the event is in the FALSE state. If event is in the TRUE state, the script will just continue run normally. This allows for two functional modes
The event is in the false state and the script halts, waiting for the event to become true.
The event is in the true state and the script continues to run, most likely in a reset loop, until the event becomes false causing the script to halt.
NOTE
When the system powers up some of the BT LEDs will be ON. This is NOT the same as controlled by the Android application. If you plan to use either the BLUE or GREEN LED to control your script, you must cycle the LEDs to the desired state.
One simple way to build a script is to construct a table of the different options and then indicate what is to happen at each time interval. Here is an example
Time |
CMD |
Motor1 |
Motor2 |
Motor3 |
Motor4 |
LED1 |
LED2 |
LED3 |
LED4 |
1.1 |
Motor/LED |
FWD |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
1.2 |
Motor/LED |
FWD |
RVS |
OFF |
OFF |
ON |
OFF |
OFF |
OFF |
3.4 |
Motor/LED |
RVS |
FWD |
OFF |
FWD |
ON |
OFF |
OFF |
OFF |
5.7 |
Motor/LED |
OFF |
FWD |
OFF |
FWD |
OFF |
OFF |
OFF |
OFF |
8.9 |
Motor/LED |
OFF |
FWD |
OFF |
FWD |
OFF |
OFF |
OFF |
OFF |
11.3 |
Motor/LED |
OFF |
FWD |
OFF |
FWD |
OFF |
OFF |
OFF |
OFF |
15.6 |
Wait |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
N/A |
20.1 |
RESET |
OFF |
OFF |
OFF |
OFF |
ON |
OFF |
OFF |
OFF |
Firmware Update
Figure
3: Firmware Update screen
The Firmware Update screen is used to upgrade the firmware in the Brick Controller. With the Brick Controller connected to the PC, select Firmware Update in the Options menu. The Brick Controller will be placed in update mode and a new window will appear as shown below. The buttons in the tool bar are
File Open – used to pick the firmware upgrade file.
Program – used to start and complete the firmware upgrade process
Verify – used to verify the program in the Brick Controller matches the firmware upgrade file.
Exit – used to exit the firmware update mode and put the Brick Controller in normal operating mode.
Once in Firmware Update mode, press the file open button and select the firmware update file provided. Once the file is loaded, press the program button. Wait for the process to complete as indicated by the message “Verify passed!”. At this point press the Exit button and the Brick Controller will restart in normal mode. Verify new firmware version in lower right of the Main Screen.
CAUTION
Interrupting the update process could result in a frozen or ‘bricked’ unit. Please be patient while the update process is working.
NOTE
The restart process may take several tries, so again please be patient while the system is reconnecting.