FTC Samantha Module

The Samantha Module was lastly used in 2014-2015

Overview

The Samantha Wi-Fi Module is an 802.11b wireless to USB adapter for use with the LEGO® MINDSTORMS® NXT and the FIRST® Tech Challenge (FTC®) Robotics platforms. This device connects, via a USB cable, to the NXT and allows it to wirelessly communicate with the FTC Field Control System, which is used to control Robots during Matches at FTC competitions.

The Samantha Module is a rectangular black device measuring 3.5″ x 2″ x .5″. The top of the Module has a red button. On the bottom of the Module are the USB and power ports. On the face of the device there are three status LEDs: Red – Power; White – Wi-Fi; Blue – NXT. At the top and the bottom of the Module are semi-circular tabs with holes for use when attaching it to a Robot.

aaaa

Note: This image is of a second generation Samantha Module. There are no functional differences between a first and second generation Module. A version one Samantha Module can be identified by its rounded edges and separate mounting bracket.

Samantha Module Setup

Connecting to the NXT

Communications to the NXT are accomplished by a USB-‘A’ to USB-‘B’ serial cable connected from the Samantha Module directly to the NXT. It is recommended that Teams use the shortest length of USB cable possible to connect the two devices.

Connecting to the power supply

The Samantha Wi-Fi Module has an input voltage range from 5V DC to 18V DC and can be powered by the TETRIX Robotics power supply or from a 9V battery in conjunction with the MATRIX Robotics platform.

For more information on wiring an FTC Robot, see the FTC Robot Wiring Guide.

TETRIX

When using the TETRIX Robotics platform, it is important to wire the Samantha Module in parallel with the other electrical components in order avoid a disruption of power, should one portion of the system fail (i.e. a loose wire).

Using butt-splice connectors or soldering, connect the ends of the Samantha Module Power cable into the electronics system of the Robot, as pictured below. If soldering, cover the connections with electrical tape or heat-shrink tubing.

1111

MATRIX

The MATRIX Robotics kit includes an integrated Motor Controller that has 4 motor and 4 servo ports (see Figure 1). This integrated Motor Controller was not designed to allow the Samantha Module to be connected to the same power supply as the Motor Controller. The power circuit for the Motor Controller shares the same ground plane as the Sensor port that connects the controller to the NXT. If the Samantha Module is powered from the same battery as the Motor Controller, under certain circumstances a large current could inadvertently flow through the NXT and destroy the controller, the NXT, and the Samantha Module.

The manufacturer strongly recommends against powering the Samantha Module from the same battery as the Motor Controller.

llk

A 9V alkaline battery can be used to power the Samantha Module directly. Figure 2 shows a Samantha Module next to a power cable that has a 9V snap connector soldered to the cable. Heat shrink tubing is used to insulate the soldered connections. A diagram and parts list for building a power cable is included on the next page of this document.

Some important items to note when powering the Samantha Module using a separate 9V battery:

 Disconnect the battery in between

Matches to avoid draining the battery and to

minimize traffic that is on the Playing Field’s wireless network. Teams should also bring backups.

 The Field Control System (FCS) software polls the Samantha Module to check the battery voltage of the Robot. If the Samantha is powered by a separate 9V battery, the FCS will not be able to check the actual voltage of the Robot’s main power supply. Instead, the FCS will only check the voltage of the 9V alkaline battery.

 The FCS will highlight this lower-than-expected voltage condition in red in the FCS window

adasdasdasd

;l;l

Samantha Module Placement

The Samantha Module provides a highly reliable Wi-Fi connection between FTC Robots and the Field Control System. However, the integrity of this communication link is dependent on the quality of the signal with the FCS and the USB connection between the Samantha Module and the NXT. To ensure the Samantha Module performs well, it is important to place it properly on the Robot and to practice strain relief on the USB connection.

Placement

In order to ensure the Samantha Module can communicate with the Field Control System, use the following guidelines when deciding where to place it on a Robot:

 A vertical placement of the Module is best; while Teams might see a marginal improvement in signal if the Module is mounted horizontally, the Samantha will not receive a signal if the cable becomes dislodged. Therefore vertical placement is recommended, because it is easier to support the cable and keep a constant physical connection.

 Mount the Samantha Module as high on the Robot as possible

 Avoid burying the Module inside the Robot Chassis, as the metal will interfere with signal strength

Strain Relief

During FTC Matches, Robots are subjected to rapid accelerations and decelerations, jarring impacts, rapid turns, etc. These actions can lead to a strain on the USB connection, which in turn can cause the cable to become loose. Loose cables can cause:

 A loss in communication between the Samantha

and the NXT;

 A loss of Tele-Op control for up to 10 seconds while

the link is reestablished;

 A loss in communication between Samantha and

the FCS.

Guidelines to avoid communication issues:

 Mount the Module vertically with the USB port facing downward. The cable should hang down straight with

no strain put on it in any direction.

 Horizontal mounting has the most potential for loosened

connections, but this can be mitigated with proper strain

relief.

 Prevent any relative motion between the NXT and the

cable by using zip ties to hold the cable in place. Make

sure the NXT is securely mounted as it will tend to shift

during rapid Robot maneuvers.

Use as short a USB cable as possible, usually 12″, to

eliminate a large mass of cable swinging around your

Robot and pulling on the connections. After you have

coiled excess cable, make sure to zip tie it securely in

several locations to prevent it from shifting during a Match.

 Ferrite Chokes are one way to electrically isolate your signal cables from your power network. These iron cores are placed around your cables and can be purchased cheaply from a local electronics center. Ferrite Chokes will help reduce interference on the line from the motors and help reduce the effects of electro-static discharge. The most important wire to protect is the USB cable running between your Samantha and the NXT.

 Mount the Module as high as possible on your Robot. This will improve Wi-Fi reception and make it easier for the refs and FTAs to see the LED status lights, which will help diagnose any potential communication issues.

 Do not bury the Module behind a mass of metal, like the Chassis or large sheets of aluminum. This will create a Faraday cage and prevent the Wi-Fi signals from reaching the Module.

 It’s recommended that you attach a short USB extender cable to your Samantha Module to make it easier to access the Module when it is attached to your Robot and to reduce the strain on the Samantha Module’s USB support.

asdasdasdasdasdasdasdasd

Network Setup Overview The Samantha Module is one portion of a larger system called the Field Control System (FCS). This system includes the computer, which runs the software that displays the Match clock and sends commands to Robots on the Field; the router, which passes commands to the Samantha Module; and the GamePad Controller being operated by Teams. In order for the Samantha Module to function, the FCS must be set up correctly and the Samantha Module must have a passkey “flashed” onto it. Requirements In order to use the Samantha Module, a Field Control System is required. However, this guide does not cover the process for setting up the FCS. To learn how to setup an FCS, review the FCS Setup materials on the FTC Team Resources webpage. To setup the FCS you will need the following items:  Computer (preferably running Windows 7, SP1)  Router (Asus Asus RT-N66R, CISCO E3000, Linksys E900, E1200, E300)  Samantha Module (Ver. 1 or 2)  Joystick (Logitech Dual Action Gamepads, Logitech F310 gamepads (set to “dual action” emulation mode)  USB thumb drive Connecting to the Field Control System In order for the Samantha Module to communicate with the rest of the FCS, it needs to have the appropriate network key loaded into its memory. As part of setting up an FCS, a thumb drive is created which contains those keys. To upload these keys onto a Samantha Module, follow these steps: 1. Power on the Samantha Module and wait for it to finish the power up sequence of red, white, blue, white, red. 2. Insert the thumb drive into the USB port on the Samantha Module 3. The LED status lights will flash through the following sequence: red, white, blue, white, red and then display a solid red and flashing white LED Once the network key is uploaded onto the Samantha Module, it is ready to connect to the FCS.

Operating the Samantha Module Once the Samantha Module is properly attached to the Robot, connected to the NXT, the Field Control System is operational, and the network key is loaded, it is ready to go. Samantha Module LED Status Light Codes The Samantha Module is equipped with three LEDs lights – red for power, white for Wi-Fi, and blue for NXT. Each LED relays specific information regarding connection and power.

Untitled

The LEDs can also communicate specific messages when they are lit in conjunction and sequence with each other. The images in the left column of the table below display the sequence of lights for the actions listed in the right column. In real time, the LEDs would flash in a left- to-right, top-to-bottom sequence. The sequence is detailed in the right column.

asdsadsadasd

lalal

Updating the Samantha Module Firmware In some instances, it becomes necessary to update the firmware on the Samantha Module. To perform this task, a thumb drive, a power supply, and the latest version of the FCS are required. 1. Install the FCS, found at http://www.usfirst.org/roboticsprograms/ftc/team-resources 2. Navigate to the following folder on your computer:  My computer\Local Disk\Program Files (Program Files (X86) on a 64-bit system)\Samantha Field Control System\Samantha  Copy the file named “Samantha.hex”. This is the firmware file 3. Insert thumb drive into computer and paste the “Samantha.hex” file onto it 4. Remove the thumb drive from the computer and insert it into the Samantha Module. 5. While holding the red button on the Samantha Module, turn the Samantha power supply on 6. Release the red button once the red LED status light is solid and the white LED is flashing 7. The LED status lights will cycle through the following sequence when the operation is complete:  Red  white  blue  white  red *Note: Updating the Samantha Firmware erases any stored network keys. However, a network key can be loaded onto the Samantha Module at the same time as the firmware. The process for this is the same as updating just the firmware, except the light sequence will cycle through twice when it is done loading the firmware and the network keys. The process for updating both firmware and network key can take longer than just updating one or the other.

Troubleshooting Samostat Samostat is a utility program that can be installed on the LEGO NXT. It is used to communicate with a Samantha Wireless Module and to display status information about the Module. Samostat is useful for troubleshooting a wireless connection and provides the following information:  What version of the firmware is installed on the Samantha Module?  What is the IP address of the Samantha Module?  What is the quality of the TCP connection to the Field Control System (Samostat provides some basic network statistics that provide a rough indication of network quality)?  What are the names of the primary and secondary networks that are configured in the Samantha?  Is the Samantha Module connected to a network? If so, is it an ad hoc or infrastructure connection?  Is the Samantha connected to a network other than the primary or secondary network? If so, what is the name and type (ad hoc or infrastructure) of the network? The Samostat program is available in both LabVIEW and ROBOTC. By default, when you load either the LabVIEW or ROBOTC firmware onto a LEGO NXT, the Samostat program should be included with the firmware install. The Samostat program should be located in the “Software Files” folder on the LEGO NXT. The source code for the Samostat program is also available for LabVIEW and ROBOTC.

l;kkkkkk

Message area – contains text describing current activity or errors. Typical messages might be: “Configuring IP”, “Reacquiring”, or “?Wrong Encryption”. IP Address – IP address assigned for the Field or pit router as identified by the ‘*’ entry in the Networks area. TCP Connection Stats – A series of numbers (0/0/0:0.00) indicating the basic state of the TCP connection. 1. Back-off increments/ ; are the number of times that the network stack decided that it wanted to increase the amount of time to wait to send a message. Note that this is normal to have happen when it is closing a web connection, so you should expect to see this number generally increase over time. 2. Back-off Decrements/ ; are the number of times that TCP decided that the network has improved and can decrease the amount of time to wait to send a message. In general, you should not expect to see this number change from zero, but a lot of numbers increasing here is an indication of a noisy wireless environment. 3. Resets: ; is the number of times that TCP decided that everything was good enough to go back to the normal timeout. This can occur during the normal TCP negotiation of the connection, so unless you see many Decrements this number is not so meaningful. 4. Wait Time; is the longest time that TCP has decided to back-off when the network is congested. This number should never get above half a second unless the wireless environment is extremely noisy in which case almost no network traffic would be going through. You should expect to see this around 0.10 seconds indicating normal traffic throughput. Connection Networks Activity – identifies the SSIDs of the Field and pit networks that Samantha has been programmed to detect. There are two character spaces preceding the network names:

1. The leftmost character is one of an asterisk, question mark, or no character. An asterisk (*) indicates the network that Samantha is connected to. A question mark (?) indicates there is a problem connecting to this network. 2. The second character from the left is either an ampersand or no character. An ampersand (@) indicates that this network is an ad hoc network. No character indicates that it is an infrastructure network. 3. The upper network SSID is associated with the Competition Field Network. 4. The lower network SSID is associated with the Pit Network.

aaaa

aw

aqq

qqq

po

799

Advanced Samantha Module Topics This section is for app developers and Field Technical Advisors attempting advanced debugging. TCP/UDP Ports used by the Samantha Module The Samantha Module actively uses the following TCP and UDP ports: Port 80 – TCP Allows you to query stats of the Samantha Module – you can open up a web page to view this during a Match. You can also query a variety of other information using Step 7 from the Samantha Pairing document. This is where the debug log comes from. To find this information, use the IP address of the Samantha Module in a web browser. On a Windows Platform, you can also use the name of the NXT. For example if the Team number is 2901 then you can go to: http://nxt2901 Port 137 – UDP Used for NetBIOS naming –This port maps the NXT name to the IP address of the Samantha Module. Port 30303 – UDP This is the discovery protocol port and will return status information when the announce protocol is used. When you send a ‘D’ message, a response comes back with information about the Samantha Module and a state character of the form: E Another IP Address has reserved this Module for exclusive use. Y This IP Address has reserved the Module for exclusive use O The NXT attached to the Samantha Module is offline A The Samantha Module is available for connection U The Samantha Module is currently in use Port 2901 – TCP The Samantha Module accepts TCP/IP Socket connections on port 2901 and forwards commands it receives on this port to the NXT that is attached to the Samantha Module via a USB connection. It employs a pairing mechanism that is designed to allow the Robot owner to accept the connecting party connecting on port 2901 as a legitimate client. Note that all of the messages on this port are forwarded to the NXT over the USB port. The list of commands can be found in the following document: click here.

Pairing Process The pairing process is intended to prevent malicious parties from taking control of the Samantha Module and, by extension, the Robot during a competition, while still allowing legitimate clients such as the Field Control System (FCS), Robot Inspection processes, and other clients to connect to the Samantha Module.

55

Step 1-4: The client submits an HTTP request to acquire exclusive use of the Samantha Module and the NXT Brick. Once exclusive use has been granted to a client, any other client can still submit HTTP requests to view the status of the Robot, but cannot connect to port 2901 in order to send NXT commands to the brick and thereby control the Robots actions. The HTTP request to acquire exclusive use looks like: click here.

The CGI command will return the IP address of the client that currently has exclusive use of the Samantha Module. This may be the IP address of the requestor if the request succeeded, or the IP

12

address of some other client that currently holds exclusive use, or the text “none” may be returned if no client current has exclusive use of the Samantha Module. Step 3: If more detail is required about the success/failure of the initial request, then the last error can be retrieved via an HTTP request that looks like: click here.

This request returns the last error text associated with the requesting IP Address. The last error is a human readable error message. If the password sent in on the request is in the list of known passwords already accepted by the Samantha’s owner as legitimate and no other client currently has exclusive use, then the request for exclusive use succeeds and the last error text is set to: Exclusive use successfully acquired

If the Samantha Module recognizes the password as legitimate, but some other client has already acquired exclusive use, then the request will fail and the last error will be set to: Exclusive use already held by If the Samantha Module does not recognize the password, then the lights on the Samantha Module will cycle alerting the Samantha’s owner that someone is trying to gain exclusive use of the Samantha Module, and the last error text will be set to: Invalid Password. Press button on Samantha to pair. The Samantha owner can accept the connection by pressing the button on the Samantha Module. This will cause the password to be added to the known password list and in the future clients using this password will be granted exclusive use without prompting the Samantha owner to hit the button again. The full list of error messages returned by the SAMANTHALastErrorByIP.htm request as a result of a prior exclusiveUse.cgi request to gain exclusive use includes: 1. Exclusive use successfully acquired 2. Exclusive use already held by 3. Invalid Password. Press button on Samantha to pair. 4. Invalid Password. Unable to force connection from 5. Invalid Password. Cannot force a connection. 6. Failed request from due to exclusive use previously acquired by 7. Password is too long. It must be 32 characters or less. 8. Blank password not allowed. Step 5-6: If the prior request to exclusiveUse.cgi failed, then hopefully the Samantha owner has seen the cycling lights and pressed the button to add the password from the prior request to the list of known legitimate client passwords. In this case a subsequent request to acquire exclusive use should succeed. However, if the request failed because some other client has exclusive use, then a request to acquire exclusive use must include the force option. Any client whose password is in the list of legitimate client passwords can force a connection to the Samantha Module that will cause the connection to the other client to be closed (and the FCS to report a message of it happening). The HTTP request would look like: click here.

Step 7: Once the client has gained exclusive use of the Samantha Module, it can open a connection to TCP port 2901 and send NXT commands and receive NXT responses. If the socket open fails a subsequent request for the last error can be made to determine the cause of failure. The last error for connections on port 2901 can be retrieved using: click here.

which will return a JSON response string which includes as part of it the last error associated with communications on port 2901

444

7000

Possible errors include: 1. Refused connection from due to exclusive use previously acquired by 2. Refused connection from exclusive must be acquired prior to connecting (Please note that versions of the Samantha Module prior to 1.47 have misspellings for these two errors). Once the client is done communicating with the Samantha Module, it can release its hold by executing the following HTTP request: click here.

12

12231213

333

99

0

---

Configure Samantha Wi-Fi Module for Tetrix and NXT

 

 

12313

1233412312

78556754

How to connect to Samantha WiFi module using ROBOTC

Download and Install the latest NXT drivers. 32-bit: http://www.robotc.net/files/NXTUSBDriver_32bit.zip 64-bit: http://www.robotc.net/files/NXTUSBDriver_64bit.zip Also install the latest version of the Samantha firmware (currently 2.02, maybe newer) found in the Firmware folder of your ROBOTC installation or on the FIRST FTC site.

Connect NXT to computer using the USB cable and set your Platform Type to “Lego Mindstorms NXT + Tetrix” by clicking on the “Robot” menu, then on the “Platform Type” sub-menu, then on the “LEGO Mindstorms” sub-menu, and finally selecting “Lego Mindstorms NXT + Tetrix”:

4234234234

Update firmware by clicking on the “Robot” menu, then on the “Download Firmware” sub-menu, and finally on “Standard File”:

obama

Select your NXT and click on “F/W Download” to begin the download process.

Once the firmware has been successfully downloaded, disconnect the USB cable from your computer and connect it to the Samantha module. * For this tutorial on getting ROBOTC to use Samantha WiFi with the NXT, we assume that you have already configured a network and your Samantha module to work properly. If you have not yet configured your Samantha module to work on a network, please do so before continuing on to the next step. *

Once the firmware has been downloaded successfully, we need to setup ROBOTC to use the Samantha module. To begin this process, click on the “Robot” menu, then on the “NXT Brick” sub-menu, and finally on “Communication Link Setup”:

ASSAD

In this NXT Brick Link Selection window, find the dropdown-menu titled, “Search Selection” and choose either “USB or WiFi” or “USB, Bluetooth, or WiFi”. Then click on the button,”Repeat Search” below it to search for your NXT:

GJHGJK

If everything thus far was successful, you should see your NXT name and WiFi address in the box titled, “NXT Bricks Reachable via Bluetooth or Wi-Fi”. Select your device and click the button on the far right labeled, “Select”:

ASDASDFSFE

* Note that if your brick name appears as, “No Avail”, then the Samantha module isn’t paired with the NXT. Press the small button on the top of the Samantha module for one second to pair your NXT to the Samantha module and try again. If your brick name appears as, “NoComm”, then your NXT may have turned off, or the USB cable isn’t securely attached between the NXT and the Samantha module. *

 You should now see your device listed in the box labeled, “NXT Brick Connection History”:

Click on “Close” and you’re all set! You should now be able to both Download and Compile programs as well as use the ROBOTC debugger via Samantha WiFi!

 A quick tutorial on how to set up and test your Samantha Module