HySense User Manual

From Tribotix Wiki
Jump to: navigation, search

- need to add a blurb here to describe the HySense's features not utilised in HyKim but of interest to people considering HySense as a stand alone processor for Dynamixel based robots.

--Peter 07:15, 27 June 2008 (EST)


Contents

Hardware

PB0806 HySense - Body Data Acquisition Module

Image Not Yet Available.jpg
PB0806 Top View


Documentation
Schematics:
Sub-modules:
6-axis IMU
The 6-axis IMU that can be fitted to either HySense or HySense Lite are made from 2 modules we source from Spark Fun. Using their 5-axis IMU, which consists of a 3-axis accelerometer and 2-axis gyro, and an additional Z-axis gyro allows us to create this 6-axis IMU. The schematics for their breakout boards along with the device datasheets are below:
5-axis IMU
Schematics:
Datasheets:
Z-axis Gyro
Schematics:
Datasheets:
Digital Compass
Datasheets:
Software:
IR Distance Sensors
Datasheets:
Datasheets:
Software:
  • ATMega128 bootloader, link to be added here ....
  • ATMega128 software, link to be added here ....
Firmware:
  • ATMega128 bootloader firmware, link to be added here ....
  • ATMega128 firmware, link to be added here ....
Programming

An Atmel ATMega128 is used as the mcu for HySense, this mcu can be programmed 2 ways:

  1. By the In System Programmer (ISP), J1 - 6pin IDC connector. USB AVRISP’s are commercially available and can be used as one of the methods of programming via the ISP. There are many other circuits that can be built to function as an ISP.
  2. via a bootloader configured for UART1. UART1 is connected to the CM-iGLX via a multi-dropped RS485 channel, this allows the user to:
    1. generate an executable on a PC,
    2. transfer the executable wirelessly to the CM-iGLX, then
    3. transfer the executable to UART1 via CM-iGLX’s USB to RS485 converter.


The application AVRStudio (freeware) can be used to program the Atmel in C. AVRStudio can be downloaded from Atmel’s web site.

GPIO Allocation

The Atmel ATMega128 has 8 available analog inputs, this is extended to 16 by using a SDI 8-channel A2D I/O extender – TI ADS7844. Also, a PNI MicroMag3 3-Axis Magnetic Sensor Module gives another 3 analog inputs via the SDI port.


The Body Data Acquisition module acquires the following data:

  1. Tilt-Compensated Digital Compass,
  2. 6-axis Inertial Measurement Unit (IMU),
  3. Infrared Distance Sensor.


The table below describes where each analog signal is read.

Device Channel Description
ATMega128 AI0 5-axis IMU AX
AI1 5-axis IMU AY
AI2 5-axis IMU AZ
AI3 5-axis IMU REF
AI4 5-axis IMU GX
AI5 5-axis IMU GY
AI6 IR Distance Sensor
AI7 IR Distance Sensor
ADS7844 Ch0 1-axis Gyro A1 (temp)
Ch1 1-axis Gyro A2 (2.5V)
Ch2 1-axis Gyro A3 (G-Z)
Ch3 External AI3
Ch4 External AI4
Ch5 External AI5
Ch6 External AI6
Ch7
MicroMag3 AI0 MicroMag3 Compass k-X
AI1 MicroMag3 Compass k-Y
AI2 MicroMag3 Compass k-Z


To aid in programming the Body Data Acquisition module, the table below shows the complete I/O allocation for the ATMega128 and ADS7844.


HySense GPIO.jpg


A pdf document with the GPIO allocation may also be downloaded: HySense - GPIO Allocation


Software

HyInt and HySense, the Body Data Acquisition Module communicate via a multi-drop RS485 serial channel. The other node on this serial channel is HySense Lite, the Head Data Acquisition Module.

Connection: HyInt USB1 - USB to RS485 Converter - HySense UART1

Source Code and Firmware
Software:
  • ATMega128 bootloader, link to be added here ....
  • ATMega128 software, link to be added here ....
Firmware:
  • ATMega128 bootloader firmware, link to be added here ....
  • ATMega128 firmware, link to be added here ....

Protocol

HyInt communicates with the Data Acquisition Modules using a 2-wire asynchronous serial channel, the parameters for this serial channel are as follows:

  • Baud Rate: 115200Kb/s,
  • Number of Data bits: 8,
  • Parity: NO,
  • Stop Bits: 1.


The network established between HyInt and the Data Acquisition Modules is a MASTER - SLAVE topology, i.e. all commands are initiated by the MASTER, HyInt, whilst the SLAVE simply responds to these commands. For all commands issued by the MASTER, the Data Acquisition Modules will respond with an ID that is equal to the OPCODE. Please note that the Data Acquisition Modules will not respond to any illegal or corrupt packets.


The packet structure used for commands and responses is shown in the tables below:


Command Packet Structure

Length Value Description
1 <SOH> Packet Start byte
1 <ID> Device ID
2 <LEN> Data length (Not including <OPCODE>, <CRC> and <LEN>)
1 <OPCODE> Operation code
0-1024 <DATA> Data
2 <CRC16 > Two bytes CRC16 checksum


Response Packet Structure

Length Value Description
1 <SOH> Packet Start byte
1 <ID> Device ID (reserved for future usage)
2 <LEN> Data length
1 <Answer ID> Operation code
0-1024 <DATA> Data
2 <CRC16 > Two bytes CRC16 checksum


Definitions:


  • <SOH> = Start byte. (0xFF)
  • <CRC16> is the same which is used by Xmodem/Ymodem, Formula: CRC16 = x^16 + x^12 + x^5 + 1


Example:


Here is an example of the data flow, e.g. sending a ‘Get Distance’ command to head board:

SENDER: <soh> 0x02 0x01 0x00 0x00 – CRC(High) – CRC(Low)
RECEIVER: <soh> 0x02 0x01 0x00 0x04 - data(4bytes)- CRC(High) - CRC(Low)

Commands

The commands used between HyInt and HySense are very similar to HyKim CommsProtocol v1, but they are slighty different as the number and types of sensors used in v2 of the electronic system differ. This section will be completed very soon.

Debugging Tips

There is a second Uart port which is used for debug. In normal mode, you can only to see debug information through this Uart. You can also switch it to communication port, by simply type “PC” then Enter in Hyper Terminal. After that you can send command listed in the previous section to the board and even update the firmware image.

Personal tools