|
|
|
|
|
|
|
|
|
 |
|
Developing embedded microcontrollers on Macintosh
|
|
1. Lego RoboLab or School's Mindstorms
|
|
|
|
|
|
|
Lego sell a consumer robot kit called Mindstorms that enables you to build a robot and program it using a graphical language called RCX. The CD on the consumer version does not include Macintosh software, even though it is available.
Robolab 2.5.4, also called Mindstorms for schools, runs native under OSX and is functionally the same as Mindstorms. It is available in Australia from Educational Experience. The team challenge set is very similar to the original consumer Mindstorms kit.
|
|
Robolab communicates to the Lego computer brick using an infrared link. There are two options for connection:
- older: Serial tower connectes to Keyspan USB to serial converter via serial cable
|
|
|
|
 |
|
 |
|
|
|
As part of a subject we run a robot builders competition where students build a robot from lego to solve a soccer problem.
Winner of 2000 robot builders competition (QuickTime 3.1Mb) |
|
|
2. newer: USB tower connected to Macintosh USB port with Lego computer brick |
|
 |
|
|
|
|
| When we have visits by high school students we get them to build robots that can play a game of tag (QuickTime 7.9Mb). Download the the design for the tag robot and download the LabVIEW program. |
|
 |
|
|
Start of program showing:
- program start
- declare red counter
- rotate motors to drive robot forward
- split program into two threads
|
|
|
|
Java for RCX
|
|
LeJOS is a package that allows the RCX brick to be programmed in Java. The site includes a tutorial on how to download, install and run LEJOS on Mac OSX. Additional information is available on the faq (frequently asked questions) site |
|
2. Parallax Basic Stamp
|
|
|
|
|
A Basic Stamp is an embedded processor available from Parallax
- There are many sensors, motor controllers, audio/video cards, and radio links available for it.
- There is a web site with interesting sensing and control experiments for both hobiests and students
- Five robot kits are available, including: a wheeled mobile robot and a quadruped robot
- If you are using the USB Board of Education download a Mac OSX USB driver from FTDI and skip Step 2
|
|
 |
|
Step 1 - purchase a Basic Stamp
- We bought a BASIC Stamp 2p40 Professional Starter Kit (left)
- purchase a 7.5 volt 1 amp dc power supply (not a battery charger)
|
|
|
Step 2 - make a serial cable
- the ibm pc cable with the kit doesn't work with a Macintosh
- Cut an Apple serial cable in two
- Wire a DE9 male connector to the end (connections below left
- connect the Basic Stamp to the Macintosh via the serial cable plugged into the Keyspan port
|
|
 |
|
 |
|
|
|
| An article in MacTech magazine gives more details on making the cable.
Djajadunungrat, T. and Stienstra, M. Programming the Basic Stamp, MacTech, Vol 20, I 5, pp 22-32
|
|
Step 3 - download and install the macbs2 editor from Murat N Konar
- run the editor
- the first time you run it it will ask you to download and install the PBASIC Tokenizer
- Stuffit expander will unstuff it and it will install automatically
- select the serial port with the pop up menu on the top right
|
|
|
|
|
|
|
|
 |
|
Step 4 - test that it all works
- Type in the hello phillip program or download Hello.bs2
- line 1 - tells the compiler which Stamp you are using
- line 2 - tells the debugger to display "Hello Phillip" in the debugger pane
- Download and run the program over the serial link - click the run button
- The words "Compiled OK. Downloading..." should appear in the console pane
- The words "Hello Phillip" should be written in the <debugger pane> by the Basic Stamp over the serial link
|
|
|
 |
|
 |
|
|
| If you get the message below in the console pane you should go back and check all connections and that you have power to the Basic Stamp |
|
|
|
 |
|
Step 5 - Role your own
- If you have made it this far then everything works
- Now start writing embedded programs
|
|
|
3. Java embedded microcontroller - TINI
|
|
A TINI (Tiny InterNet Interfaces) is a microcontroller that runs a Java Virtual Machine
- Made by Dallas Semiconductor (Maxim) in two models: DS80C390 and DS80C400
- The best doccumentation is Getting Started with TINI (.pdf 2.4MB) - page numbers refered to below
- Two SDKs and firmware can be downloaded from Dallas Semiconductor
- Download copy of TINI SDK from this site (.sitx 3.7Mb)
- Taylec sell DS80C390 TINI boards and Mother Boards with i/o connectors
- Download Copy of Taylec Doccumentation and examples from this site (.sitx 972KB)
|
|
 |
|
|
|
|
| DS80C390 card and mother board from Taylec |
|
Connecting a TINI to a Macintosh Host
|
|
|
|
1. Installing the host software |
|
- Create a folder in which you are going to work - e.g. TINISetup
- DownLoad the TINI 1.0 Firmware SDK from Dallas (Version 1.02h) and put it in the TINISetup folder
- Alternate download from this page
- NOTE: Version 1.0 has to be installed and working before Vesrion 1.1 can be installed (page 14)
- The tini1.02h folder contains several folders
- bin - contains the TINI firmware and other binaries
- Examples - contains source code for a number of example applications including Blinky
- src - contains source code in .jar files (Use Stuffit Expanded to reveal contents)
|
|
- JavaKit is a Termial GUI that runs on the Macintosh and talks to the TINI over a serial link
- Download this XCode project (292 Kb) and put it in your TINISetup Folder
- You will find a JavaKit application in JavaKit/build/Debug
- If you want to can create your own JavaKit swing application:
- the files are in tini1.02h/src/JavaKitSrc Folder/ (expand JavaKit.jar)
- remember to replace the import of javax.com with an import of gnu.io
|
|
|
- slush.tbin is the code that executes a UNIX like terminal shell on the TINI
- tini.tbin is the JVM that executes on TINI
|
|
|
- Blinky is a test program that we will use to test our installation and demonstrate XCode programming
- Download this XCode project (372Kb) and put it in your TINISetup folder at the same level as the tini1.02h folder
- You will find Blinky.tini in Blinky/build/debug
|
|
| 2. Setting up and checking the serial connection |
|
|
- Setup and test the Java Serial api as explained in the page on Macintosh Serial Input/Output - Macintosh Java Serial
- Testing JavaKit - the termial GUI that runs on the Macintosh Host over the serial link
- for testing connect a loopback cable to the Keyspan USB to serial
- Run the XCode project and build JavaKit - or use the application in JavaKit/build/Debug
- Select the port and Open the port
- Type and the text you type will appear in the window via the loopback cable
- Connect a serial cable from the Macintosh (Keyspan USB to Serial adaptor) to the TINI
- same serial cable as to the Parallax above
- Also connect an ethernet cable to a network
- Connect the power to the TINI
- Connect to the TINI
- Run JavaKit, select the port and open the port
- click on the reset button to start the boot loader, prompt should appear
|
|
|
3. Loading the TINI firmware |
|
|
|
|
| The only software installed on a TINI is a bootloader that you use to install the firmware and the terminal shell
Menu - File->Load File - select file to down load
|
|
 |
|
|
|
| JavaKit GUI after sucessful connection to a TINI |
|
| 1. Select and download slush.tbin
(page 19)
|
|
| 2. Select and download tini.tbin |
|
|
3. Initialise the heap
- bank 18 - select memory bank
- fill 0 - set the heap to 0
|
|
| 4. Boot TINI firmware
5. Start Slush command line shell
6. Choose Dumb Terminal
7. Login (page 21)
- user: root
- password: tini
|
|
4. Slush Commands
- help - gives a list of commands (page 23)
- command help - gives a list of options for command
|
|
|
|
|
5. Setting up a Network connection and logging in |
|
|
5.a. How you connect to the network will depend on your network configuration (These instructions are for DHCP)
- ipconfig -d - selects DHCP automatic network configuration
- ipconfig lists the network configuration - example below
|
|
|
 |
|
|
|
|
| 5.b. Once the network connection is established, you can access a date server to automatically set up the date - this will tell you whether you can get to the www or are blocked by a firewall |
|
 |
|
|
|
|
 |
|
5.d. Login in to the TINI
Now we can choose to use either:
- the serial connection with JavaKit or
- the telnet connection with Terminal
|
|
| 5.c. Start the Macintosh Termial program and telnet to the TINI over the network |
|
| 6. Creating an XCode project for Blinky.Java |
|
|
|
|
|
Steps |
|
- Create an XCode project for a Java program without a GUI
- Edit the Java program including imports of TINI specific libraries
- Compile the Java program
- Convert the .class file to a .tini file that a TINI can execute
- Download the .tini file to the TINI and execute it
|
|
| Details |
|
|
- (1) Create an XCode project named Blinky - File->New Project
- Put the project folder in your TINISetup folder at the same level as the tini1.02h folder
- use the Java Tool template to get a Java application without a GUI
- (2) add a link to tiniclasses.jar to the project to use the TINI libraries - Project->Add to Project
- import com.dalsemi.system.BitPort; requires a link to tiniclasses.jar
- Other applications will require other .jar files - Some are in tini1.02h/bin, and some are in the Taylec examples
- Select 1.1 for the Target VM and 1.3 for the Source Version
- Double Click on the Blinky Target Icon in the XCode browser and select the Java Compiler Settings tab
- Add a new build phase to hold a shell script to convert a .class file to a .tini file as the last phase of the build process (4)
- Click on the arrow next to the Blinky Target icon to reveal the build phases (Screen dump below left)
- Project Menu->New Build Phase -> New Run Script Build Phase - to add a new build phase
- Double click on the Run Script icon to open the script window (screen dump below right)
- Copy the script into the Run script window as shown
- (3) Compile and build the program - output Blinky.tini can be found in build/Debug
|
|
|
|
 |
|
|
 |
|
|
- PROJ = absolute path to the project directory
- TINIDIR = path to the TINI bin folder relative to PROJ
- NAME = name of the project and the folder it it in - normal set up of XCode project
- executes the command TINIConvertor with 3 options (page 28)
- -f : location of the class file
- -d : location of the tini makefil
- -o : where to put the output file
- .tini output is saved in Debug folder
- To obtain a copy of script download the XCode version of Blinky an look in the Run Script phase
|
|
| 7. Download a TINI application (Blinky.tini) |
|
|
|
|
Use ftp to transfer Blinky.tint over the network into the TINI with either
- command line in the TINI Shell (page 29) or
- an ftp client on the Macintosh (Fetch)
|
|
|
 |
- Create a new ftp connection:
- Enter TINI IP address and login
- Put Blinky.tini from Macintosh to TINI
- Click on Put button
- Navigate to and select Blinky.tini
- Select setting and click Put
|
|
|
|
|
|
|
 |
|
|
|
| Use TINI commands to confirm that Blinky.tini has been downloaded and is not executing |
|
 |
|
|
| 8. Execute the Program |
|
|
|
|
|
|
 |
|
Login to TINI and enter commands
- ls - check that program is loaded
- java Blinky.tini & - run in background
- ps - show running programs and process numbers
- kill n - kills process n
- del Blinky.tini - removes program
|
|
|
4. Sun SPOT- embedded Java
The Sun SPOT is a Java microcontroller for developing
embedded systems and sensor networks in Java. Program
development is done using Netbeans under Mac OSX.
Sun provides instructions on how to set up the
development system and how to download and
setup the SDK on a Macintosh.
The code is compiled into a suite file that is downloaded
to the Sun SPOT over a USB link, where it is interpreted
by the JVM on the SPOT. SPOTS can be networked
using wireless links.
Our experience in devloping with Sun SPOT is detailed
in a recent paper.
6. ATMEL microprocessors on a Mac
Instructions on how to download and install the AVR Toolchain are reasonalby complex. An install package was created to make it easier. More recently CrossPack for Macintosh was released for AVR development.
The Evil Mad Scientist describes a project to control 16 leds with a 20 pin Atmel ATtiny2313. Again, due to rapid developments in the support of Macintosh there are updates.
Return to Phillip McKerrow or site Index
Page updated Monday 26th August 2009 |
|
5. Embedded Mac Mini
Our experience in using a Mac Mini to control a robot
is detailed in a recent paper.
The Mac Mini is mounted on the mobile robot and is
setup to be the base station of an adhoc network.
This can be done manually, but that requires a
keyboard, mouse and monitor connected to the
Mac Mini. We installed an application to run on
start up to set up the network. The source code for
this application is subject to a confidentiality
agreement, but I can supply an executable.

We use a mac book to control the Mac Mini using
Apple Remote Desktop. Once the Mac Mini has
launched its nework, we can establish a connection
using Remote Desktop and control the Mac Mini
remotely.
We replaced the Mac Mini power supply with a DC
to DC inverter connected to the 24v traction batteries.

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|