Frequently Asked Questions about various Hardware and Software

TelosB Motes

 

ePuck Robots

Getting Started

Few links which are important in order to getting started with ePucks.

1. MPLAB IDE

MPLAB IDE is a software program that runs on a PC to develop applications for e-puck and other Microchip microcontrollers. MPLAB IDE can be downloaded from the following link:

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023073

Download MPLAB IDE v8.0 the latest version. 

2. MPLAB C30 Compiler

MPLAB C30 compiler is necessary to compile and build C programs for e-puck. MPLAB C30 is an ANSI x3.159-1989-compliant, optimizing C compiler that includes language extensions for dsPIC DSC embedded-control applications. The compiler is a Windows ® console application that provides a platform for developing C code. The compiler is a port of the GCC compiler from the Free Software Foundation. MPLAB C30 Compiler can be downloaded from the following link:

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023073

Download MPLAB C30 v2.05 Student Edition 

3. Tiny Pic bootloader

Tiny Pic bootloader is a bootloader for the Microchip PIC microcontrollers. By using this you can load your program on to the e-puck. Tiny Pic bootloader can be downloaded from the following link:

http://www.etc.ugal.ro/cchiculita/software/picbootloader.htm

Download tinybld197 the latest version.

 

Bluetooth and ePuck

The e-puck has his Bluetooth module connected on the uart1. Two ways are possible when you work with

Bluetooth:

• You are the master.

• You are the slave.

When you are the Master, Bluetooth library package contains all the resources you need to control the Bluetooth device you have on your e-puck AS MASTER. If you only want to use the Bluetooth AS SLAVE, the uart library is enough (the connection to a master look like a standard uart connection). The Bluetooth device is connected on the uart1.

Generally, the Bluetooth modules have a Bluetooth class device which identifies them as PC, mobile, mouse ... The e-puck Bluetooth module has the default device class number, and it’s 000.

When you are the slave, you can communicate with the master device exactly by the same way as you do to communicate through the uart. The Bluetooth protocol is made to look like as transparent as possible. This is possible because the master initialize the communication and the Bluetooth module answer automatically to create the connection. After the connection is created, you can communicate with the master by using the uart protocol.

E-puck communicating with PC:

There are two ways to connect to e-puck and operate the e-puck.

1. Operating using HyperTerminal:

Pair the e-puck with your computer: this will create a new virtual COM port that you can use to communicate with the e-puck. With HyperTerminal (All Programs -> Accessories -> Communications-> HyperTerminal), connect to this COM port and control the e-puck.

Example Program would be BTCom/Sercom present in the e-puck folder.

Message can be received from the PC using the following: e_getchar_uart1 (&c)

and to send message to PC e_sendchar_uart1

2. Controlling e-puck using C/C++ or Java programs:

There is a tools/e-puck_monitor programs which uses C/C++ programs to control and it is well documented.

E-puck communicating with e-puck:

For communicating between e-pucks, one of the e-puck has to be master and other can be slave. The master e-puck should use Bluetooth library and connect to the e-puck and then go into transparent mode and can send and receive messages from uart1. Slave e-puck does not have to do anything; it can send and receive messages from uart1.

Example Programs:

1. Bluetooth mirror on one e-puck(master) / Bluetooth2 on one e-puck(master)

2. BTCom on another e-puck(slave)

All these example programs are present in the e-puck_lib/programs in the e-puck.rar present in the same folder.

 

Usage of Libraries and Programming the e-puck

Libraries of e-puck

e-puck Libraries can be obtained from the following link:

http://www.e-puck.org/index.php?option=com_remository&Itemid=71&func=select&id=7                                         

As per the puck-gettingstarted.pdf, tutorial for how to program e-puck using Bluetooth, all the library files have to be present in the same folder.

It is not necessary to do so; it would be difficult if we are trying to build a big project, which involves large number of library files.

To make it easy and simple to program the e-puck, the following should be done to the libraries downloaded

Change the path of the ‘#include’ statements in each file of the library to windows path.

For example:

            #include "library/uart/e_uart_char.h"

            Change it to

            #include "C:\e-puck\e-puck-lib\library\uart\e_uart_char.h"

By doing the above you can directly add you files into project(no need to copy all the library files into one folder)

Note: We have already changed the path of all the files and zipped. These zipped library folder is named e-puck.rar. If you need this file, you can send us an email. This file also contains some example programs and some tools to control e-puck from PC. It also contains MPLAB IDE and MPLAB C30 Compiler

Stargate Netbridge

We are using Stargate Netbridge extensively in out Lab. If you have any question, please let us know.

 

Connect SN to PC via cross over cable

  • Open LAN properties.

  • Scroll all the way down to Internet Protocol (TCP/IP).

  • Click Properties.

  • In the General tab, select Use the following IP Address.

  • Fill the fields as following

    IP Address                        : 192.168.1.1

    Subnet Mask                     : 255.255.255.0

    Default Gateway  : 192.168.1.1

  • Turn off the firewall by selecting Advanced tab from LAN properties. It is must otherwise you will not be able to access SN from PC.

  • Test the connection by typing following on command promp

C:\>ping 192.168.1.77

You should see output something like

Pinging 192.168.1.77 with 32 bytes of data:

Reply from 192.168.1.77: bytes=32 time=2ms TTL=64

Reply from 192.168.1.77: bytes=32 time<1ms TTL=64

Reply from 192.168.1.77: bytes=32 time<1ms TTL=64

Reply from 192.168.1.77: bytes=32 time<1ms TTL=64

 

Connect PC to Internet via wireless and connect SN to PC via crossover cable and got work both of them.

 

Select Internet Protocol (TCP/IP) Properties of wireless network. Select Advanced. Uncheck Automatic Metric and set Interface Metric value to 10. This way you are setting wireless network to be preferred to Ethernet connection whenever the two connections are active simultaneously.

For more details, please refer to

http://www.velocityreviews.com/forums/t297470-wireless-and-wired-network-together-on-windows-xp.html

 

Stargate

Accessing Stargate using PC

Connect the Stargate to the PC using a NullModem Serial cable.
Make sure switches S1 and S3 are turned "ON".
Log in to the Stargate through HyperTerminal -a terminal emulation program on windows-using the following settings.

Name - any Name.
Connecting Using -- Choose the appropriate com port to which the stargate is connected.
Bits per second -115200.
Data Bits -8.
Parity - None.
Stop Bits - 1.
Flow Control - None.

After connecting to StarGate through HyperTerminal -

Stargate login - root
Password - rootme

Assigning fixed IP address to StarGate -

make the following changes to the file init.d  ( /etc/init.d)

 #!/bin/sh

#

# start/stop networking daemons.

 

if ! [ -x /sbin/ifup ]; then

    echo "Unable to configure network. Missing /sbin/ifup."

    exit 0exit 0exit 0

fi

 

case "$1" in

    start)

        echo -n "Configuring network interfaces: "

        ifup -a

#        pump -i eth0

 

        ifconfig eth0 129.130.10.177 up

        route add default fault gw 129.130.10.1

 

        ifconfig lo 127.0.0.1 up

        echo "done."""""

        ;;

    stop)

 

The above ip address 129.130.10.177 is mac address unique.

Starting an application on Bootup

In the init.d folder create the following script file

#!/bin/sh

# Start program as a background task

#!/bin/sh

 

if [ -r /mnt/cf1/cfcard.rc ]; then

  #Echo -n "Starting CF mounted applications: ""

  /mnt/cf1/bin/armsf 9001 /dev/tts/2 57600 >/dev/null 2>&1 &

  #echo "ok"

fi

 

  • The above script starts the armsf application which resides on cf card automatically on bootup as a background application.

  • if Statement checks to see if the cfcard is mounted.

  • armsf is a program that acts as a serial forwarder on port (9001),listens to serial port (/dev/tts/2) at baud rate of 57600

  • >/dev/null redirects the standard output to null device.

  • 2>&1 is to redirect standard error to null device.

  • The final & is to run the program in the background.

 

Setting a link to the above script file

 

ln –s /etc/init.d/"myBootupScript" /etc/rc2.d/S99myBootupScript

 

S99 represents the relative startup priority of the bootup script.

 

Programming Motes remotely through the StarGate

 

  • Build an application with mote-id on the host computer ->

 

    make micaz //build application

 

    set-mote-id build/micaz/main.srec build/micaz/main.srec.out 1 //set mote-id

 

  • Copy above image with an id assigned to Stargate

 

    scp build/mica2/main.srec.out root@<Stargate IP Address>/usr

 

  • Programming mote connected to StarGate with above application (Make sure that no application is using the serial port.)

 

    cd/usr

 

    $ uisp -dprog=sggpio -dpart=ATmega128 --wr_fuse_h=d9 --wr_fuse_e=ff --erase --upload if=main.srec.out

C Serial Forwarder

We have made C serial forwarder to write packets to TelosB motes. Please let us know if you need some help.

Java Serial Forwarder

Packet format of the TelosB mote is different from the default packet format (micaz format, that is 5 bytes of header, and payload) which TinyOS uses. The Java code must read the packet in the appropriate format, that is message sent by TelosB has 10 bytes of header, and payload. For Java to read the correct format change the MessageFactory class. Replace the MesageFactory.java with our file in opt\tinyos-1.x\tools\java\net\tinyos\message and compile. Please let us know if you need modified MesageFactory.java.

TOSSIM

 

ZigBee Relays

We have developed some applications in Java for ZigBee relays. If you want to know how to control ZigBee relays using Java, please send us an email.





PerSNL, Department of Computing and Information Sciences - Kansas State University
Nichols 16-A, Manhattan, KS 66506
Phone: (785)532-7842; Fax: (785)532-7353; Mailto: persnl@cis.ksu.edu