HyKim v2

From Tribotix Wiki
Jump to: navigation, search

HyKim version 2 is a minor revision, i.e. v1 to v2 was a necessity due to the phasing out of the DX-117 and the introduction of it's replacement, the RX-28. The changes & improvements made from HyKim v1 to v2 are:

Dynamixels
  • due to the phasing out of the DX-117, HyKim needed to be redesigned based around the RX-28.
Mechanical improvements
  • Introducing the RX-28 meant that off-the-shelf hinge brackets (straight) could be utilised.

Contents

Introduction

We believe HyKim is one of the world’s most advanced commercially available legged robots, being capable of both Bipedal and Quadrupedal motion.


The design of HyKim, the 21DOF Robot Bear, was originally completed to meet the RoboCup Federation Call for Tenders: A Standard Robot Platform for Robot Soccer issued in November 2006. The design was a collaborative project between Tribotix and NUBots (The University of Newcastle, Australia) - a very successful RoboCup 4 Legged League team. More information can be found on the history of this project at Tribotix’s web site. The modular design of HyKim reflects the structure of HyKim's User Manual in that the user manual is based around the User Manuals of the modules that make up HyKim.


RobotBearCollage.jpg


HyKim is a modular design, i.e. all of the major modules within HyKim where either specifically designed or off-the-shelf modules. The modules that were specifically designed for HyKim were designed in such a way that they could be standalone products and incorporated into other robotic designs. The main modules that constitute HyKim are shown in the image below.


Modules.jpg
Overview of the Modules used in KyKim (v0 & v1)


We welcome any comments or questions about HyKim. If you have any comments or questions please see the Contact Us section of our web site for contact details. HyKim is a high quality research platform and we hope that the information provided on this wiki accelerates any research projects using HyKim as their basis.

What's included with HyKim

To be expanded upon ....

  • 21DOF Robot Bear
  • 2 LiPo Rechargable Batteries
  • LiPo Charger
  • 13.8V 20A Switch Mode Power Supply
  • AVRISPMkII (ATMega In-Circuit Programmer)

Documentation - Quick Find

Links to schematics, source code, firmware and/or component datasheets for HyKim v2 are shown below in the following sub-sections.

Dynamixels

RX-28 User Manual
RX-64 User Manual

HyInt

Schematics:
Datasheets:
Software:
Firmware:
In HyInt v1 analog signals for battery voltage and current draw were passed to RM0604R2's ATMega128, so there is no software or firmware required.
N.B. In HyInt v2 an ATMega8 was used to perform these, and other, functions.



RM0604 Body Data Acquisition Module

Schematics:
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 ....

RM0605 Head Data Acquisition Module

Schematics:
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 ....

OLED's

Schematics:
Datasheets:

Sensor Board

Schematics:

Modules

3-axis Accelerometer
Datasheets:
1-axis Gyro
Datasheets:
Digital Compass
Datasheets:
IR Distance Sensors
Datasheets:

Safety Issues

SECTION to be completed ....

Handling LiPo Batteries

When compared to other types of rechargeable batteries, such as Nickel Cadmium (NiCd) and Metal Hydride (NiMH), Lithium Polymer (LiPo) batteries are much lighter, larger in capacity, and have no memory effect. But LiPo's are a new technology and can be volatile or dangerous.


So, before using and charging the LiPo's supplied as part of HyKim ALL users should read the Safety Instructions and Warning provided by the manufacturer. Failure to read and follow these instructions may result in fire, personal injury and damage to battery or property.

  • You must read these safety instructions and warnings before using or charging your batteries.
  • Lithium Polymer (LiPo) batteries are new technology and can be volatile or dangerous.
  • Tribotix, its distributors or retailers assume no liability for failures to comply with these warnings and safety guidelines.

Charging LiPo Batteries

to be completed ....

Powering HyKim

to be completed ....

Motor Positioning

to be completed ....

High Torque

to be completed ....

Small Screws

to be completed ....

HyKim's Features

Features

Hykim Features Lge2.jpg
HyKim Features - image shows HyKim v2

Design

Hykim Frnt Feet.jpg

The main features of HyKim’s design are:

  1. HyKim’s ability to move both as a biped and quadruped robot.
  2. HyKim’s torso can move laterally about the base of it’s spine, allowing for realistic bipedal and quadrupedal movements.
  3. HyKim’s can rotate about the shoulders, unlike other quadrupedal robots (such as Sony Aibo).
  4. HyKim’s body is currently made from ABS plastic, and
  5. HyKim’s front feet have an ingenious non-motorised design.This allows the front paw to be straight whilst in the bipedal position and bent as a paw would bee whilst in a quadrupedal position Another advantage of this design is that it cushions HyKim’s transition from biped to quadruped.

Processing

HyKim has a central processing module, known as HyInt, and 2 smaller mcu’s, known as HySense and HySense Lite, which provide localised data collection and basic pre-processing of the collected data.


The HyInt processing module is based around Compulab’s CM-iGLX computer module. Detailed information on the system can be found later in this document, but a brief summary of it’s features are listed below:

  • AMD Geode 500MHz mcu,
  • 256kb cache,
  • 256 Mb DDR,
  • 512Mb FLASH Disk,
  • 802.11g wireless,
  • 100Mbps Ethernet,
  • 2 COM ports (both used for communications with Data Acquisition modules),
  • 3 USB ports (1 used for Dynamixel interface,& 1 used for Webcam)
  • 1Mbps interface to Dynamixel modules, and
  • Battery monitoring circuitry.


HyInt communicates serially to each of the Data Acquisition modules, HySense and HySense Lite. The Data Acquisition modules allow data to be collected locally, pre-processed and then the results can be transferred serially to HyInt. One of the Data Acquisition modules is located in the head whilst the other is located in the body directly above HyInt. The data acquired by these modules is from a:

  • 6-axis Inertial Measurement Unit (IMU),
  • Infrared Distance Sensor, and
  • Tilt compensated Digital Compass (Body module only).


The local acquisition of data, along with 21 mcu’s within the Dynamixel modules, means that there are 23 mcu’s distributed around HyKim’s body (not including HyInt), making HyKim’s design a highly distributed processing architecture.


Both Data Acquisition modules are based around the Atmel ATMega128 mcu. Both of these mcu’s connect serially to HyInt, this serial channel can be used to either:

  1. program the ATMega via a bootloader (located within the ATMega), or
  2. transfer the information collected from the various sensors.


Detailed information on the Body Data Acquisition modules, HySense and HySense Lite can be found in the relevant section of this User Manual.

OS_coverage

Compulab’s CM-iGLX can run either:

  1. Embedded Linux,
  2. Windows CE, or
  3. Windows XP.

Tribotix have developed an embedded Linux image based around debian etch (Debian 4.0r2), Linux Kernel: 2.6.18 which includes all the required device drivers. This image may be downloaded from our web site, be aware though that this image is approximately 250Mb.

Sensors

HyKim has various sensors spread across it’s body. A detailed description of each sensor can be found later in the document, but a brief summary of available sensors follows:

  • Sensors located in HyKim's head:
  1. Logitech Pro5000 Webcam (drivers available for both Linux & Windows),
  2. 6-axis Inertial Measurement Unit (IMU),
  3. Infrared Distance Sensor,
  4. 3 Capacitive Touch Switches (under HyKim's chin).
  • Sensors located within HyKim'sbody:
  1. Tilt-Compensated Digital Compass,
  2. 6-axis Inertial Measurement Unit (IMU),
  3. Infrared Distance Sensor.

As well as the standard sensors mentioned above, both of HyKim's Data Aquisition modules, HySense and HySense Lite, have all unused GPIO, iic bus and the SPI bus from the ATMega128's brought out to IDC Headers allowing the user to add additional sensor if required.

Displays

128x128 OLED.jpg

HyKim has 2 128x128 OLED’s mounted in its head and are connected via an SDI bus to the Head Data Acquisition module, HySense Lite.

These OLED’s can either be used as ‘eyes’ or to display diagnostic information, which can be extremely useful for debugging the embedded system.

Motors

Dynamixel Module.jpg

HyKim is based around Robotis’s RX Dynamixel range of serially controlled, smart servo motors which are:

  • based around quality Swiss Maxon motors,
  • contain all metal gears to ensure durability,
  • use a bearing at the final axis to ensure that there is no efficiency degradation with high external loads on the output shaft, and
  • able to communicate at 1Mbps on a half-duplex RS485 network.

RX-28’s and RX-64’s were used for HyKim – there are 3 RX-64’s used, these are used for the top of the hind legs and also to control the lateral ‘side-to-side’ motion of torso.

A summary of the specifications for the RX module used follows:

RX Module Specifications
RX-28 RX-64

Reduction Ratio: 1/193
Holding Torque: 28.3kg-cm
Speed: 0.167sec/60°
(Specs at 12V)

Reduction Ratio: 1/200
Holding Torque: 64.0kg-cm
Speed: 0.162sec/60°
(Specs at 18V)

Power_Source

Whilst operating autonomously HyKim is powered by an 11.1V 2480mAh Lithium Polymer rechargeable battery pack. During normal operation, HyKim draws an average of 2.5~3.0A – so a fully charged battery pack should give 45~55 minutes of operation. The time period quoted is based on average power consumption, some operations (such as the transition from quadruped to biped) can draw significant large currents (up to 6A), so obviously the operational time from the battery pack will depend largely on the movements performed by HyKim .


HyKim processing system, HyInt , converts the 11.1V provided by the battery to both 5V and 3.3V. Circuitry within HyInt monitors both the battery voltage and the current drawn from the battery. Two separate voltage thresholds for the battery are set such that when the voltage from the battery starts to decay, power will be removed from the Dynamixel modules - this allows HyInt to shutdown gracefully before it loses power. Please note that Lithium Polymer (LiPo) battery packs have a very ‘sharp’ discharge curve, i.e. as the charge within the battery pack reduces, the voltage seen at the batteries terminals will fall to 0V very quickly.


Also for convenience, when developing software HyKim can be powered by a conventional lab power supply.

HyKim Modules

This section of the document will discuss each of HyKim's modules – the modular design of HyKim is one of its design strengths.

System_Overview

The diagram below shows how the modules that make up HyKim are defined and interconnected.


HyKim Block Diagram v1.jpg


There are 4 main modules with HyKim, these are:

  1. HyInt the main processing module (includes Compulab’s CM-iGLX),
  2. Body Data Acquisition module, and
  3. Head Data Acquisition module,
  4. Network of Dynamixel motors spread around HyKim's body.


The 4 modules mentioned are connected serially to form a Star type network, as illustrated below:

HyKim Network v1.jpg


NB. In the diagram above showing HyKim's network topology, the USB connection to the Logitech Webcam is also included for completeness.


HyInt is obviously the core system here. HyInt should be the Master in this star topology, making the decisions when it should request data and issue commands to the Slave modules. HyInt must be the Master when communicating with the Dynamixel modules, the firmware installed in the Dynamixels requires this (this cannot be changed). But, with regard to the Data Acquisition modules, communication properties (Master or Slave) can be defined by the programmer(s) as the firmware in the Data Acquisition systems can easily be changed.


HyKim Wiring v1.jpg


The diagram above again shows the Star network topology but this time in more detail. The CM-iGLX has 3 USB ports, one of these is used for the Logitech Webcam, another is used to talk to the Dynamixel modules (via a USB to RS485 conversion circuit) whilst the final USB port remains spare for the user to use as is seen fit.

The CM-iGLX has 2 COM ports, these are both used to talk to the Data Acquisition modules. It should be noted however that because there are only 2 COM ports available, the Head Data Acquisition module’s serial channel is also used as the debug port for the CM-iGLX when required (generally only during initial configuration of the CM-iGLX). This is simply achieved by changing the connection on J2 of PB704A.

Dynamixels

Features

Dynamixel Module.jpg

HyKim is based around Robotis’s Dynamixel range of serially controlled, smart servo motors which are:

  • based around quality Swiss Maxon motors,
  • contain all metal gears to ensure durability,
  • use a bearing at the final axis to ensure that there is no efficiency degradation with high external loads on the output shaft, and
  • able to communicate at 1Mbps on a half-duplex RS485 network.

RX-28’s and RX-64’s were used for HyKim – there are 3 RX-64’s used, these are used for the top of the hind legs and also to control the lateral ‘side-to-side’ motion of torso.

A summary of the specifications for the RX module used follows:

RX Module Specifications
RX-28 RX-64

Reduction Ratio: 1/192
Holding Torque: 28.9kg-cm
Speed: 0.172sec/60°
(Specs at 12V)

Reduction Ratio: 1/200
Holding Torque: 64.0kg-cm
Speed: 0.162sec/60°
(Specs at 18V)


The Robotis Dynamixels use a 1Mbps half-duplex RS485 channel for communications to the host controller, which in this case is the HYINT module. The fact that HYINT has high-speed 2-way communication with the Dynamixels allow for many operational parameters/variables to be sent/received – this 2-way communication is what makes the Dynamixels ideal for this type of application. The main parameters/variables that are available within the Dynamixel are:

  • Clockwise (CW) rotation limit,
  • Counter-clockwise (CCW) rotation limit,
  • Maximum Temperature alarm,
  • Maximum and minimum Voltage alarm,
  • Maximum torque,
  • Compliance settings,
  • Goal Position,
  • Required moving Speed,
  • Torque Limit,
  • Present Position (10bit resolution, i.e. 0~1023),
  • Present Speed,
  • Present Load,
  • Present Temperature, and
  • Present Voltage.


As you can see from the list above, there are many parameters that can be set and variables that can be interrogated for a Dynamixel module. A comprehensive manual exists for both the RX-28 and RX-64 , these User Manuals detail the structure of the data packets exchanged between the Dynamixels and the host controller and the reader is referred to these for more detailed information.

Dynamixel ID allocation for HyKim

The allocation of network ID’s for the RX Dynamixels is detailed in the following table as well as shown in the image below.


HyKim IDAllocation.jpg
Dynamixel ID Description
0x02 2 Shoulder – rotation
0x03 3 Back – lateral movement
0x04 4 Front Left Shoulder
0x05 5 Front Right Shoulder
0x06 6 Front Left Leg Up/Down
0x07 7 Front Right Leg Up/Down
0x08 8 Front Left Elbow
0x09 9 Front Right Elbow
0x0a 10 Back Left Shoulder
0x0b 11 Back Right Shoulder
0x0c 12 Back Left Leg Up/Down
0x0d 13 Back Right Leg Up/Down
0x0e 14 Back Left Knee
0x0f 15 Back Right Knee
0x10 16 Back Left Ankle
0x11 17 Back Right Ankle
0x12 18 Back Left Foot – rotational
0x13 19 Back Right Foot – rotational
0x14 20 Neck – Up/Down
0x15 21 Head rotate
0x16 22 Head – Up/Down


NB. We have deliberately not allocated any of the Dynamixels within HyKim to ID 0x01 - this is to make it easier to replace a Dynamixel in the unlikely event that a Dynamixel should fail. ID 0x01 is the default setting for new Dynamixels, so all that is required to replace a Dynamixel is physically replace the Dynamixel then send the relevant new ID and baud rate commands to ID 0x01.



Positioning the Dynamixels in the Centre Position

During the assembly of HyKim the positioning of the centre of each Dynamixel is important so that maximum movement from each DOF may be achieved. Dynamixels have a 300° operational range which is controlled in increments of 0.25°, i.e. 1024 steps (10bit resolution). Therefore 150° or 512 is the centre position for a Dynamixel module. The image below shows HyKim in the ‘Drop Bear’ pose – this is the pose where all the Dynamixels are told to go to their centre position, i.e. 150°.


HyKim DropBear.jpg


To illustrate the positioning or centring of the Dynamixels used at the top of HyKim's legs, the diagram below shows how the Dynamixels are positioned – notice there is an offset in the rear leg, this is so that maximum movement can be achieved in both biped and quadruped mode.


HyKim DynamixelCentres.jpg

Preventing Damage to Dynamixels

Although the Dynamixels are highly durable they can be damaged and destroyed. This generally occurs when a Dynamixel is commanded to go to a position it physically can’t achieve, e.g. there is a frame preventing movement to the required position. What happens in this case is that, for some reason, the Dynamixel can’t reach the desired location BUT the Dynamixel keeps trying UNTIL it damages it’s internal H-Bridge circuit (and the smoke comes out ….).


There are 2 ways to ensure this doesn’t happen:

  1. Set the Clockwise (CW) and Counter-clockwise (CCW) rotation limits to reflect the physical constraints of the robot. This means that even if your program tries to place a Dynamixel in a position it could never achieve the Dynamixel will only move to the limit then stop - saving the Dynamixel from damage, and
  2. Monitor the temperature reading from the Dynamixel. There are a couple of ways this can be handled, the Dynamixel can turn it self off automatically if it gets too hot or the program in the host controller could make this decision and shut the robot down by moving all Dynamixel to their home positions.


It should also be noted that it is impossible to replace a Dynamixel and have the new shaft position exactly the same as the Dynamixel being replaced – this is a mechanical constraint. So when programming HyKim it is a good idea to have a table of ‘offsets’ of each of the Dynamixels from the ideal position – this way when a Dynamixel is replaced that only change to software will be in the offset table.

HyInt

Hardware

HyInt Bottom v1.jpg
HyInt v1

As shown in the illustration below, the HyInt module consists of 3 pcb’s. These are:

  1. CM-iGLX: this is a prefabricated computer module supplied by Compulab.
  2. Motherboard: this board is the interface for the CM-iGLX and allows all the CM-iGLX’s ports to be brought out to the appropriate types of connectors. The 802.11g WLAN mini-PCI card is also mounted on this board.
  3. Power Supply Board: this board is where the supply voltage is converted to 5V and 3.3V for the various electronic modules distributed around HyKim. This board also has circuitry that monitors the supply voltage and alarms the CM-iGLX when the supplied voltage drops below a pre-determined voltage.


HyInt Mounting.jpg


The illustration above also shows the Body Data Acquisition module (Body Sensors), this board is mounted horizontally on the top of HYINT via J10 (10-pin connector).


The table below shows the allocation of the ports available to the user on the HyInt module.


Connector Port Type
PB704A J1 USB3 – Logitech Webcam
PB704A J2 COM1 – Head Data Acquisition module
PB704A J7 mini-PCI – 802.11g WLAN module
PB704A J10 Audio – 1 Channel in and out
PB704A J11 Ethernet
PB704A J12 VGA
PB704A J13 USB1 – Spare USB (available to user)
PB704B J1 USB2 – Dynamixel RS485 Connector (1)
PB704B J2 USB2 – Dynamixel RS485 Connector (1)
PB704B J3 USB2 – Dynamixel RS485 Connector (1)
PB704B J4 USB2 – Dynamixel RS485 Connector (2)
PB704B J5 USB2 – Dynamixel RS485 Connector (2)
PB704B J6 USB2 – Dynamixel RS485 Connector (2)
PB704B J9 Battery Connector
PB704B J10 Mounting connector for Body Data Acquisition module
PB704B J11 Body Data Acquisition module debug port (UART0)
PB704B J12 Power Supply (2.5mm DC Jack)


The following sub-sections will provide more specific information for each of the boards that make up HyInt.


Compulab CM-iGLX module

CM-iGLX.jpg


The CM-iGLX is a prefabricated computer module manufactured by Compulab and it’s features include:

  • AMD Geode LXMCU 500MHz x86 architecture:
    • no need for cross compilation when using Linux
  • Geode LXMCU contains a Floating Point Unit (FPU)
  • 256Mb DDR SRAM
  • 512Mb FLASH Disk
  • Used interfaces:
    • 2 x COM ports
    • USB (host and slave)
    • 100Mbps Ethernet
    • VGA
    • Mini PCI-bus
  • Small Size: 68 x 58mm


Our original design for HyKim was to use 2 prefabricated boards based around the Intel PXA255. These were originally chosen for their low power consumption, 0.2~3W. If you assume that during normal operation the Intel PXA255 boards used 1.6W, then for 2 boards we’d have consumed 3.2W for 500MIPS (250MIPS per board) – assuming that both boards could run at 100%, i.e. not have to wait for the other processor to complete a task before continuing. Using a single AMD Geode LXMCU we can have 990MIPS plus 270Mflops for 3~5W of power consumption. So the decision to switch from a dual Intel PXA255 to a single AMD Geode LXMCU gave us a better Power vs MIPS and Mflops ratio [ref].


Rather than reproduce all the information that Compulab make available for the CM-iGLX in this manual it is more efficient, and accurate, to direct the reader to Compulab's CM-iGLX web site. The main links of interest to the reader will be:

  1. CM-iGLX User Manual
  2. CM-iGLX Developer User

Motherboard (PB704A)

HyInt PB704A Top.jpg

Schematics: PB704A

Firmware: N/A

Sub-modules: PA3426U-1MPC 802.11 mini-PCI card


PB704A is the motherboard of the HyInt system as both the CM-iGLX and PB704B (Power Supply) boards connect to it. This board not only provides a secure mounting location for the CM-iGLX but transfers all the necessary signals from the CM-iGLX to appropriate connectors.


The connector allocation for PB704A is shown in the table below.


Connector Port Type
PB704A J1 USB3 – Logitech Webcam
PB704A J2 COM1 – Head Data Acquisition module
PB704A J3, J4 & J5 Connectors used for CM-iGLX
PB704A J6 Jumper used to clear CM-iGLX’s CMOS
PB704A J7 mini-PCI – 802.11g WLAN module
PB704A J8 Connection point for PB704B
PB704A J9 Connection point for PB704B
PB704A J10 Audio – 1 Channel in and out
PB704A J11 Ethernet
PB704A J12 VGA
PB704A J13 USB1 – Spare USB (available to user)

Power Supply Board (PB704B)

HyInt PB704B Top.jpg


Schematics: PB704B

Firmware: N/A

Sub-modules: N/A

PB704B is the board within the HYINT system that:

  1. takes the supply voltage, from either the battery pack or the DC jack, and generates 5V and 3.3V that are used by the various sub-modules within HYKIM,
  2. has circuitry that monitors the battery voltage and at preset levels shutdown the Dynamixel network whilst warning the CM-iGLX that a power shut down is imminent, and
  3. provides the connectors for the Dynamixel network.


The connector allocation for PB704B is shown in the table below.


Connector Port Type
PB704B J1 USB2 – Dynamixel RS485 Connector (1)
PB704B J2 USB2 – Dynamixel RS485 Connector (1)
PB704B J3 USB2 – Dynamixel RS485 Connector (1)
PB704B J4 USB2 – Dynamixel RS485 Connector (2)
PB704B J5 USB2 – Dynamixel RS485 Connector (2)
PB704B J6 USB2 – Dynamixel RS485 Connector (2)
PB704B J7 Connection point for PB704A
PB704B J8 Connection point for PB704A
PB704B J9 Battery Connector
PB704B J10 Mounting connector for Body Data Acquisition module
PB704B J11 Body Data Acquisition module debug port (UART0)
PB704B J12 Power Supply (2.5mm DC Jack)

Software

Compulab CM-iGLX module O/S

Compulab provide Linux (Gentoo-based), Windows CE and Windows XP images for the CM-iGLX – for more detailed information on the functionality covered by each OS, the user is directed to Compulab’s Availability of O/S and Drivers for CM-iGLX web page. The actual images can be downloaded from Compulab's Developers Resources for CM-iGLX web page.


In addition to the Linux image made available by Compulab, Tribotix have developed a 250Mb embedded Linux image that includes all the device drivers required for the peripheral hardware connected to HyInt. Details of the image follow.


debian etch (Debian 4.0r2)

Linux Kernel: 2.6.18

apache (1.3.34-4.1)

build-essentials (11.3) which includes:

  • dpkg-dev (>= 1.13.5) package building tools for Debian
  • g++ (4:4.1.1-15) The GNU C++ compiler
  • gcc (4:4.1.1-15) The GNU C compiler
  • libc6-dev [not alpha, ia64] GNU C Library: Development Libraries and Header Files also a virtual package provided by libc6.1-dev
  • make (3.81-2)The GNU version of the "make" utility.

python (2.4.4-2)

madwifi-source (1:0.9.2+r1842.20061207-2etch1)

madwifi-tools (1:0.9.2+dfsg-1) ?? I need to double check if this one is loaded

webcam (3.95.dfsg.1-1)

Downloading O/S images to the Compulab CM-iGLX module

This is where we'll put the download instructions ....

Compulab CM-iGLX module Software

This is where we'll put sample code ....

Battery Management Software (ATMega8)

PB704B in HyInt v1 has electronics to monitor battery supply voltage, so there is no firmware.

NB. HyInt v2 has an ATMega8 to perform the battery supply voltage and current readings.

Body Data Acquisition Module (RM0604)

RM604 Body Data Acquisition Module

HyKim BodyBrd.jpg
RM604 Top View


The Body Acquisition module, RM604, mounts directly above the HYINT as shown in the image below.


HyInt BDAM.jpg
RM604 mounted at the top of HYINT


Hardware

Documentation

Schematics:
Sub-modules:
Datasheets:

Programming

An Atmel ATMega128 is used as the mcu for the Body Data Acquisition module. 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 COM2 of the CM-iGLX, 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 COM2 port.


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, and the Body Data Acquisition module requires 12 analog inputs. To solve this an SDI 8-channel A2D I/O extender was used – TI ADS7844.


The Body Data Acquisition module acquires the following data:

  1. Tilt-Compensated Compass;
  2. 1-axis Gyro;
  3. HyInt operating variables:
  4. 3-axis Accelerometer; and
  5. Infrared Distance Sensor.


The table below describes where each analog signal is read.

Device Channel Description
ADS7844 Ch0 Tilt-Compensated Digital Compass - X
Ch1 Tilt-Compensated Digital Compass - Y
Ch2 Tilt-Compensated Digital Compass - Tilt
Ch3 2-axis Gyro – 2.5V reference
Ch4 2-axis Gyro – Rate Out
Ch5 2-axis Gyro – Temperature
Ch6 HyInt operating variables – Supply Voltage
Ch7 HyInt operating variables – Current
ATMega128 AI0 3-axis Accelerometer - X
AI1 3-axis Accelerometer - Y
AI2 3-axis Accelerometer - Z
AI3 Infrared Distance Sensor - distance


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


Device Pin Type Alloc. Description
ATMega128 10 D PB0 CS (SDI for ADS7844)
11 D PB1 DCLK (SDI for ADS7844)
12 D PB2 DIN (SDI for ADS7844)
13 D PB3 DOUT (SDI for ADS7844)
14 D PB4 Shutdown (SDI for ADS7844)
15 D PB5 Busy (SDI for ADS7844)
35 D PC0 Spare DIO0 (J5 p3)
36 D PC1 Spare DIO1 (J5 p4)
37 D PC2 Spare DIO2 (J5 p5)
38 D PC3 Spare DIO3 (J5 p6)
39 D PC4 Spare DIO4 (J5 p7)
40 D PC5 Spare DIO5 (J5 p8)
41 D PC6 Spare DIO6 (J5 p9)
42 D PC7 Spare DIO7 (J5 p10)
25 D PD0 i2c SCL (J2 p2)
26 D PD1 i2c SDA (J2 p2)
27 D PD2 RXD1 (to CM-iGLX)
28 D PD3 TXD1 (to CM-iGLX)
2 D PE0 RXD0 (Debug serial channel)
3 D PE1 TXD0 (Debug serial channel)
61 A PF0 ADC0 - 3-axis Accelerometer - X
60 A PF1 ADC1 - 3-axis Accelerometer - Y
59 A PF2 ADC2 - 3-axis Accelerometer - Z
58 A PF3 ADC3 - Infrared Distance Sensor - distance
51 D PA0 Tilt-Compensated Digital Compass - SR
ADS7844 1 A Ch0 Tilt-Compensated Digital Compass - X
2 A Ch1 Tilt-Compensated Digital Compass - Y
3 A Ch2 Tilt-Compensated Digital Compass - Tilt
4 A Ch3 1-axis Gyro – 2.5V reference
5 A Ch4 1-axis Gyro – Rate Out
6 A Ch5 1-axis Gyro – Temperature
7 A Ch6 HyInt operating variables – Supply Voltage
8 A Ch7 HyInt operating variables – Current


A pdf document with the GPIO allocation may also be downloaded: Body Data Acquisition Module - GPIO Allocation

Software

HyInt and the Body Data Acquisition Module (RM0604) communicate via a TTL level asynchronous serial channel.

Connection: HyInt COM2 - Body Data Acquisition Module (RM0604) 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

Read Distance

This command will read the IR Distance Sensor

Command format
Field Size (byte) Value Description
OPCODE 1 0x01 Operation code
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x01 Answer ID
Distance 2 Distance value(cm)
ADC value 2 Original ADC value from distance sensor

Read Accelerometer

This command will read the Accelerometer sensor

Command format
Field Size (byte) Value Description
OPCODE 1 0x02 Operation code
ACCM Channel 1 0-2 Accelerometer channel number
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x02 Answer ID
ACCM value 2 Accelerometer value (g*113.7)


Read Digital Compass

This command will read the Digital Compass

Command format
Field Size (byte) Value Description
OPCODE 1 0x03 Operation code
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x03 Answer ID
Compass value1 2 0-360 Compass value without tilt compensation
Compass value2 2 0-360 Compass value with tilt compensation

Read ADC value

This command will read the 8 channel internal or external ADC

Command format
Field Size (byte) Value Description
OPCODE 1 0x04 Operation code
ADC Channel 1 0-15(body board)
0-7(head board)
ADC channel number
0-7: internal ADC
8-15: External ADC
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x04 Answer ID
ADC value 2 ADC value

Read All ADC Values

This command will read the 8 channel internal or external ADC channels

Command format
Field Size (byte) Value Description
OPCODE 1 0x05 Operation code
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x05 Answer ID
ADC value 16 Internal 10 bits 8 channel ADC value
ADC value 16 External 12 bits 8 channel ADC value

Set Led Status

This command will set the onboard LED status

Command format
Field Size (byte) Value Description
OPCODE 1 0x06 Operation code
LED Status 1 0x00-0x08 Bit0 : LED0
Bit1: LED1
Bit2: LED2
Bit3: Auto controlled by sensor
See details in the table below
Description of byte ‘LED Status’
:Bit :Description
:0 :0: LED0 off, 1: LED0 on
:1 :0: LED1 off, 1: LED1 on
:2 :0: LED2 off, 1: LED2 on
:3 :0: LED0-LED2 controlled by bit0-bit2
:1: then bit0-bit2 disabled,
i.e. the 3 LEDS will be controlled by sensor board
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x06 Answer ID

Calibrate Compass

This command will start/stop calibration of the digital compass

Command format
Field Size (byte) Value Description
OPCODE 1 0x07 Operation code
Axis 1 1: Start XY axis calibration
2: Z Axis calibration
3: Stop calibration
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x07 Answer ID


Calibration procedure:
  • Put the Body Data Acquisition module parallel to the ground.
  • Send Calibration XY axis command to Body Data Acquisition module.
  • Turn the robot 720 degrees, must be kept parallel to the ground.
  • Send stop calibration command.
  • Send Calibration Z axis command to Body Data Acquisition module.
  • Turn the dog in three dimensions, try all possible directions.
  • Send stop calibration command.

Set/Rest Compass

This command will set/reset the digital compass’s offset strap to minimize the soft ion effect. Better to set/reset compass if the device is moved into a new place without restarting the power.

Command format
Field Size (byte) Value Description
OPCODE 1 0x08 Operation code
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x08 Answer ID

Read Gyro

This command will read the gyro value

Command format
Field Size (byte) Value Description
OPCODE 1 0x09 Operation code
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x09 Answer ID
Value 2 Gyro value ((Value*5)/4096 °/s/Value)
Clockwise rotation is positive output*

NB. *Only available in Body Data Acquisition module, dummy data will be returned by Head Data Acquisition module

Read All Value

This command will read all peripherals

Command format
Field Size (byte) Value Description
OPCODE 1 0x10 Operation code
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x10 Answer ID
Value 1 2 Distance
Value 2 2 Accelerometer X(g*113.7)
Value 3 2 Accelerometer Y(g*113.7)
Value 4 2 Accelerometer Z(g*113.7)
Value 5 2 Compass (without tilt compensation) *
Value 6 2 Compass (with tilt compensation) *
Value 7 2 Gyro((Value*5)/4096 °/s/Value) *
Value 8 2 Battery Voltage Monitor*
Value 9 2 Battery Current Monitor*
Value 10 2 Temperature (C°=25+((Value*5000)/(4096*8.4)))*
Value 12 1 Touch pad value*
0x00: No pad is pressed
0x01: Pad 1 is pressed
0x02: Pad 2 is pressed

NB. *Only available in Body Data Acquisition module, dummy data will be returned by Head Data Acquisition module

Update Main

This command will start the main flash update function of Atmega128. The host should run this command first then followed by YModem protocol to send the binary file within 10 seconds. After updating, the Atmega will reboot.


The firmware image file must be a plain binary image and the file name must start with “main”, for example “main_1_0_0_1_28_06_2007_Head.bin”

Command format
Field Size (byte) Value Description
OPCODE 1 0x20 Operation code
Note: this command has no answer command


Update Bootloader

This command will start the boot flash update function of Atmega128.

This command is has not been finished.

Read Main Version

This command will read the version information of the main program. Version info example: “main_1_0_0_1_04_05_2007.bin”

Command format
Field Size (byte) Value Description
OPCODE 1 0x22 Operation code
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x22 Answer ID
Version 26 Version string

Read Bootloader Version

This command will read the version information of the bootloader program.

This command is has not been finished.

Shutdown

This command will do two functions:

  1. Reset Atmega
  2. Set Atmega into power down mode
Command format
Field Size (byte) Value Description
OPCODE 1 0x24 Operation code
Function 1 0: Reset Atmega 1: Set to power down mode

Switch Port

This command will switch the communication port (Uart port). This command is for debug only.

Command format
Field Size (byte) Value Description
OPCODE 1 0x25 Operation code


Read EEPROM

This command will read data from internal EEPROM (4Kbyte size)

Command format
Field Size (byte) Value Description
OPCODE 1 0x26 Operation code
Start Address 2 Read start address
Length 2 Bytes to read
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x26 Answer ID
EEPROM Data 1-1024 EEPROM data

Write EEPROM

This command will write data into Atmega’s EEPROM

Command format
Field Size (byte) Value Description
OPCODE 1 0x27 Operation code
Start Address 2 Write start address
Data 0-1022 Bytes to be written
Note: The length of bytes to be written is defined in packet’s length. The number of bytes to be written = packet length -2.
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x27 Answer ID


OLED Write Cmd

This command will write command set into the OLED.

There are two OLED's in the robot:

OLED ID:=
0: choose left eye
1: choose right eye
2: choose both eyes
Command format
Field Size (byte) Value Description
OPCODE 1 0x31 Operation code
Device No 1 0-2 OLED device number
OLED CMD 1 OLED command
OLED data 1-n Data to be written
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x31 Answer ID

OLED Set Display mode

This command will set OLED display mode.

Command format
Field Size (byte) Value Description
OPCODE 1 0x27 Operation code
Device No 1 OLED device number
Display Mode 1 0-3 Display mode 0: All off 1: All on 3: Inverse display
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x32 Answer ID


OLED Initialize (Default Mode)

Command format
Field Size (byte) Value Description
OPCODE 1 0x32 Operation code
Device No 1 OLED device number
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x32 Answer ID

OLED Set Column

This command will set column address

Command format
Field Size (byte) Value Description
OPCODE 1 0x33 Operation code
OLED ID 1 0-2 OLED device number
Column 1 Column address(0-131)
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x33 Answer ID

OLED Set Row

This command will set row address

Field Size (byte) Value Description
OPCODE 1 0x34 Operation code
OLED ID 1 0-2 OLED device number
Row 1 Row address(0-131)
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x34 Answer ID

OLED Set Position

This command will set column and row address

Field Size (byte) Value Description
OPCODE 1 0x35 Operation code
OLED ID 1 0-2 OLED device number
Column 1 Column address(0-131)
Row 1 Row address(0-131)
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x35 Answer ID


OLED Draw Pixel

This command will draw a pixel on screen

Field Size (byte) Value Description
OPCODE 1 0x38 Operation code
OLED ID 1 0-2 OLED device number
Blue 1 (0-255) Blue value
Green 1 (0-255) Green value
Red 1 (0-255) Red value
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x38 Answer ID

OLED Power Saving Mode

This command will set LCD into power saving mode

Field Size (byte) Value Description
OPCODE 1 0x39 Operation code
Power saving Mode 1 0-1 0: Power saving mode off 1: Power saving mode on
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x39 Answer ID


OLED Draw Line

This command will draw line in screen

Field Size (byte) Value Description
OPCODE 1 0x42 Operation code
OLED ID 1 0-2 OLED device number
Col start 1 0-127
Row start 1 0-127
Col end 1 0-127
Row end 1 0-127
Colour 2 0-0xffff RRRRRGGGGGGBBBBB
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x42 Answer ID

OLED Draw Rectangle

This command will draw rectangle

Field Size (byte) Value Description
OPCODE 1 0x43 Operation code
OLED ID 1 0-2 OLED device number
Col start 1 0-127
Row start 1 0-127
Col end 1 0-127
Row end 1 0-127
Line Colour 2 0-0xFFFF RRRRRGGGGGGBBBBB
Fill Colour 2 0-0xFFFF RRRRRGGGGGGBBBBB
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x43 Answer ID


OLED Draw Circle

This command will draw circle

Field Size (byte) Value Description
OPCODE 1 0x44 Operation code
OLED ID 1 0-2 OLED device number
Col of centre 1 0-127
Row of centre 1 0-127
Radius 1 0-127
Line Colour 2 0-0xFFFF RRRRRGGGGGGBBBBB
Fill Colour 2 0-0xFFFF RRRRRGGGGGGBBBBB
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x44 Answer ID

OLED Copy

This command will Copy the rectangular region defined by the starting point and the ending point to location. If the new coordinates are smaller than the ending points, the new image will overlap the original one.


Field Size (byte) Value Description
OPCODE 1 0x45 Operation code
OLED ID 1 0-2 OLED device number
Col start 1 0-127
Row start 1 0-127
Col end 1 0-127
Row end 1 0-127
Col new start 1 0-127
Row new start 1 0-127
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x45 Answer ID


OLED Clear

This command will sets the window area specify by starting point and the ending point to clear the window display.


Field Size (byte) Value Description
OPCODE 1 0x47 Operation code
OLED ID 1 0-2 OLED device number
Col start 1 0-127
Row start 1 0-127
Col end 1 0-127
Row end 1 0-127
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x47 Answer ID


OLED Set Fill Mode

This command will enable or disable filling of colour into rectangle in draw rectangle command.

Field Size (byte) Value Description
OPCODE 1 0x48 Operation code
OLED ID 1 0-2 OLED device number
Fill mode 1 0-1 0: Fill mode off 1: Fill mode on
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x48 Answer ID


OLED Text Box

This command will set text box size for command “Print String”.


Field Size (byte) Value Description
OPCODE 1 0x53 Operation code
OLED ID 1 0-2 OLED device number
Col start 1 0-127
Row start 1 0-127
Col end 1 0-127
Row end 1 0-127
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x53 Answer ID


OLED Print string

This command will print string in the area set by command OLED TEXTBOX(0x53).

Field Size (byte) Value Description
OPCODE 1 0x56 Operation code
OLED ID 1 0-2 OLED device number
String 1-1023 ASCII String to be printed
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x56 Answer ID


OLED Draw Picture

This command will draw a bitmap picture.

Field Size (byte) Value Description
OPCODE 1 0x60 Operation code
OLED ID 1 0-2 OLED device number
Col start 1 0-127 Column start address
Row start 1 0-127 Row start address
Picture ID 1 0-3 0: Uni Logo 1: Dog’s left eye 2: Dog’s right eye
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x60 Answer ID


OLED Draw Battery Bar

This command will draw the battery bar on right screen.

Field Size (byte) Value Description
OPCODE 1 0x64 Operation code
Battery Value 1 0-100 Battery value(total 5 bars) 0: empty 100: full
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x64 Answer ID


OLED Move Eyes

This command will move dog’s eyes.

Field Size (byte) Value Description
OPCODE 1 0x66 Operation code
Left OLED Posn 1 0-13 There are total 13 positions. 0: 0 o’clock while 11: 11 o’clock,

12: is the centre of the eye, and 13: is Random positions

Right OLED Posn 1 0-13 There are total 13 positions. 0: 0 o’clock while 11: 11 o’clock,

12: is the centre of the eye, and 13: is Random positions

Answer Command
Field Size (byte) Value Description
Answer ID 1 0x66 Answer ID


OLED Draw Eyes

This command will clear the old eyes and draw dog’s eyes in the new address.

Field Size (byte) Value Description
OPCODE 1 0x67 Operation code
Col (left) 1 0-127 Left eye centre column address
Row (left) 1 0-127 Left eye centre row address
Col (right) 1 0-127 Right eye centre column address
Row(right) 1 0-127 Right eye centre row address
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x67 Answer ID

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 ‘section 6’ to the board and even update the firmware image.

Head Data Acquisition Module (RM0605)

RM605 Head Data Acquisition Module

HyKim HeadBrd.jpg
RM605 Top View


The Head Acquisition module, RM605, mounts horizontally within HyKim's as shown in the image below.


HyInt Head.jpg
RM605 mounted in HyKim's Head


Hardware

Documentation

Schematics:
Sub-modules:
Datasheets:

Programming

An Atmel ATMega128 is used as the mcu for the Head Data Acquisition module. This mcu can be programmed 2 ways:

  1. By the In System Programmer (ISP), J3 - 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 UART0. UART0 is connected to COM1 of the CM-iGLX, 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 COM1 port.


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 Head Data Acquisition module acquires the following data:

  1. 1-axis Gyro;
  2. 3-axis Accelerometer;
  3. Infrared Distance Sensor; and
  4. Capacitive Switches (3 of).


The table below describes where each analog signal is read.

Device Channel Description
ATMega128 AI0 Infrared Distance Sensor - distance
AI1 2-axis Gyro – 2.5V reference
AI2 2-axis Gyro – Rate Out
AI3 2-axis Gyro – Temperature
AI4 3-axis Accelerometer - X
AI5 3-axis Accelerometer - Y
AI6 3-axis Accelerometer - Z


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


Device Pin Type Alloc. Description
ATMega128 51 D PA0 CS1 (for OLED’s)
50 D PA1 DC1 (for OLED’s)
49 D PA2 RES1 (for OLED’s)
48 D PA3 CS2 (for OLED’s)
47 D PA4 DC2 (for OLED’s)
46 D PA5 RES2 (for OLED’s)
11 D PB1 SCK (for OLED’s)
12 D PB2 SDIN (for OLED’s)
35 D PC0 OUT1 (J1 p3 – Capacitive Switch pcb)
36 D PC1 OUT2 (J1 p4 – Capacitive Switch pcb)
37 D PC2 OUT3 (J1 p5 – Capacitive Switch pcb)
38 D PC3 GND (J1 p6 – Capacitive Switch pcb)
39 D PC4 Shutdown (J1 p7 – Capacitive Switch pcb)
40 D PC5 LED1 (J1 p8 – Capacitive Switch pcb)
41 D PC6 LED2 (J1 p9 – Capacitive Switch pcb)
42 D PC7 LED3 (J1 p10 – Capacitive Switch pcb)
27 D PD2 RXD1 (J4 p2– Debug serial channel)
28 D PD3 TXD1 (J4 p1 – Debug serial channel)
2 D PE0 RXD0 (J5 p2 to CM-iGLX)
3 D PE1 TXD0 (J5 p3 to CM-iGLX)
61 A PF0 ADC0 - Infrared Distance Sensor - distance
60 A PF1 ADC1 2-axis Gyro – 2.5V reference
59 A PF2 ADC2 2-axis Gyro – Rate Out
58 A PF3 ADC3 2-axis Gyro – Temperature
57 A PF4 ADC4 - 3-axis Accelerometer – X
56 A PF5 ADC5 - 3-axis Accelerometer – Y
55 A PF6 ADC6 - 3-axis Accelerometer – Z


A pdf document with the GPIO allocation may also be downloaded: Head Data Acquisition Module - GPIO Allocation

Software

HyInt and the Head Data Acquisition Module (RM0605) communicate via a TTL level asynchronous serial channel.

Connection: HyInt COM1 - Head Data Acquisition Module (RM0605) UART0

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

Read Distance

This command will read the IR Distance Sensor

Command format
Field Size (byte) Value Description
OPCODE 1 0x01 Operation code
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x01 Answer ID
Distance 2 Distance value(cm)
ADC value 2 Original ADC value from distance sensor

Read Accelerometer

This command will read the Accelerometer sensor

Command format
Field Size (byte) Value Description
OPCODE 1 0x02 Operation code
ACCM Channel 1 0-2 Accelerometer channel number
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x02 Answer ID
ACCM value 2 Accelerometer value (g*113.7)


Read Digital Compass

This command will read the Digital Compass

Command format
Field Size (byte) Value Description
OPCODE 1 0x03 Operation code
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x03 Answer ID
Compass value1 2 0-360 Compass value without tilt compensation
Compass value2 2 0-360 Compass value with tilt compensation

Read ADC value

This command will read the 8 channel internal or external ADC

Command format
Field Size (byte) Value Description
OPCODE 1 0x04 Operation code
ADC Channel 1 0-15(body board)
0-7(head board)
ADC channel number
0-7: internal ADC
8-15: External ADC
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x04 Answer ID
ADC value 2 ADC value

Read All ADC Values

This command will read the 8 channel internal or external ADC channels

Command format
Field Size (byte) Value Description
OPCODE 1 0x05 Operation code
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x05 Answer ID
ADC value 16 Internal 10 bits 8 channel ADC value
ADC value 16 External 12 bits 8 channel ADC value

Set Led Status

This command will set the onboard LED status

Command format
Field Size (byte) Value Description
OPCODE 1 0x06 Operation code
LED Status 1 0x00-0x08 Bit0 : LED0
Bit1: LED1
Bit2: LED2
Bit3: Auto controlled by sensor
See details in the table below
Description of byte ‘LED Status’
:Bit :Description
:0 :0: LED0 off, 1: LED0 on
:1 :0: LED1 off, 1: LED1 on
:2 :0: LED2 off, 1: LED2 on
:3 :0: LED0-LED2 controlled by bit0-bit2
:1: then bit0-bit2 disabled,
i.e. the 3 LEDS will be controlled by sensor board
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x06 Answer ID

Calibrate Compass

This command will start/stop calibration of the digital compass

Command format
Field Size (byte) Value Description
OPCODE 1 0x07 Operation code
Axis 1 1: Start XY axis calibration
2: Z Axis calibration
3: Stop calibration
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x07 Answer ID


Calibration procedure:
  • Put the Body Data Acquisition module parallel to the ground.
  • Send Calibration XY axis command to Body Data Acquisition module.
  • Turn the robot 720 degrees, must be kept parallel to the ground.
  • Send stop calibration command.
  • Send Calibration Z axis command to Body Data Acquisition module.
  • Turn the dog in three dimensions, try all possible directions.
  • Send stop calibration command.

Set/Rest Compass

This command will set/reset the digital compass’s offset strap to minimize the soft ion effect. Better to set/reset compass if the device is moved into a new place without restarting the power.

Command format
Field Size (byte) Value Description
OPCODE 1 0x08 Operation code
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x08 Answer ID

Read Gyro

This command will read the gyro value

Command format
Field Size (byte) Value Description
OPCODE 1 0x09 Operation code
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x09 Answer ID
Value 2 Gyro value ((Value*5)/4096 °/s/Value)
Clockwise rotation is positive output*

NB. *Only available in Body Data Acquisition module, dummy data will be returned by Head Data Acquisition module

Read All Value

This command will read all peripherals

Command format
Field Size (byte) Value Description
OPCODE 1 0x10 Operation code
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x10 Answer ID
Value 1 2 Distance
Value 2 2 Accelerometer X(g*113.7)
Value 3 2 Accelerometer Y(g*113.7)
Value 4 2 Accelerometer Z(g*113.7)
Value 5 2 Compass (without tilt compensation) *
Value 6 2 Compass (with tilt compensation) *
Value 7 2 Gyro((Value*5)/4096 °/s/Value) *
Value 8 2 Battery Voltage Monitor*
Value 9 2 Battery Current Monitor*
Value 10 2 Temperature (C°=25+((Value*5000)/(4096*8.4)))*
Value 12 1 Touch pad value*
0x00: No pad is pressed
0x01: Pad 1 is pressed
0x02: Pad 2 is pressed

NB. *Only available in Body Data Acquisition module, dummy data will be returned by Head Data Acquisition module

Update Main

This command will start the main flash update function of Atmega128. The host should run this command first then followed by YModem protocol to send the binary file within 10 seconds. After updating, the Atmega will reboot.


The firmware image file must be a plain binary image and the file name must start with “main”, for example “main_1_0_0_1_28_06_2007_Head.bin”

Command format
Field Size (byte) Value Description
OPCODE 1 0x20 Operation code
Note: this command has no answer command


Update Bootloader

This command will start the boot flash update function of Atmega128.

This command is has not been finished.

Read Main Version

This command will read the version information of the main program. Version info example: “main_1_0_0_1_04_05_2007.bin”

Command format
Field Size (byte) Value Description
OPCODE 1 0x22 Operation code
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x22 Answer ID
Version 26 Version string

Read Bootloader Version

This command will read the version information of the bootloader program.

This command is has not been finished.

Shutdown

This command will do two functions:

  1. Reset Atmega
  2. Set Atmega into power down mode
Command format
Field Size (byte) Value Description
OPCODE 1 0x24 Operation code
Function 1 0: Reset Atmega 1: Set to power down mode

Switch Port

This command will switch the communication port (Uart port). This command is for debug only.

Command format
Field Size (byte) Value Description
OPCODE 1 0x25 Operation code


Read EEPROM

This command will read data from internal EEPROM (4Kbyte size)

Command format
Field Size (byte) Value Description
OPCODE 1 0x26 Operation code
Start Address 2 Read start address
Length 2 Bytes to read
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x26 Answer ID
EEPROM Data 1-1024 EEPROM data

Write EEPROM

This command will write data into Atmega’s EEPROM

Command format
Field Size (byte) Value Description
OPCODE 1 0x27 Operation code
Start Address 2 Write start address
Data 0-1022 Bytes to be written
Note: The length of bytes to be written is defined in packet’s length. The number of bytes to be written = packet length -2.
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x27 Answer ID


OLED Write Cmd

This command will write command set into the OLED.

There are two OLED's in the robot:

OLED ID:=
0: choose left eye
1: choose right eye
2: choose both eyes
Command format
Field Size (byte) Value Description
OPCODE 1 0x31 Operation code
Device No 1 0-2 OLED device number
OLED CMD 1 OLED command
OLED data 1-n Data to be written
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x31 Answer ID

OLED Set Display mode

This command will set OLED display mode.

Command format
Field Size (byte) Value Description
OPCODE 1 0x27 Operation code
Device No 1 OLED device number
Display Mode 1 0-3 Display mode 0: All off 1: All on 3: Inverse display
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x32 Answer ID


OLED Initialize (Default Mode)

Command format
Field Size (byte) Value Description
OPCODE 1 0x32 Operation code
Device No 1 OLED device number
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x32 Answer ID

OLED Set Column

This command will set column address

Command format
Field Size (byte) Value Description
OPCODE 1 0x33 Operation code
OLED ID 1 0-2 OLED device number
Column 1 Column address(0-131)
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x33 Answer ID

OLED Set Row

This command will set row address

Field Size (byte) Value Description
OPCODE 1 0x34 Operation code
OLED ID 1 0-2 OLED device number
Row 1 Row address(0-131)
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x34 Answer ID

OLED Set Position

This command will set column and row address

Field Size (byte) Value Description
OPCODE 1 0x35 Operation code
OLED ID 1 0-2 OLED device number
Column 1 Column address(0-131)
Row 1 Row address(0-131)
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x35 Answer ID


OLED Draw Pixel

This command will draw a pixel on screen

Field Size (byte) Value Description
OPCODE 1 0x38 Operation code
OLED ID 1 0-2 OLED device number
Blue 1 (0-255) Blue value
Green 1 (0-255) Green value
Red 1 (0-255) Red value
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x38 Answer ID

OLED Power Saving Mode

This command will set LCD into power saving mode

Field Size (byte) Value Description
OPCODE 1 0x39 Operation code
Power saving Mode 1 0-1 0: Power saving mode off 1: Power saving mode on
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x39 Answer ID


OLED Draw Line

This command will draw line in screen

Field Size (byte) Value Description
OPCODE 1 0x42 Operation code
OLED ID 1 0-2 OLED device number
Col start 1 0-127
Row start 1 0-127
Col end 1 0-127
Row end 1 0-127
Colour 2 0-0xffff RRRRRGGGGGGBBBBB
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x42 Answer ID

OLED Draw Rectangle

This command will draw rectangle

Field Size (byte) Value Description
OPCODE 1 0x43 Operation code
OLED ID 1 0-2 OLED device number
Col start 1 0-127
Row start 1 0-127
Col end 1 0-127
Row end 1 0-127
Line Colour 2 0-0xFFFF RRRRRGGGGGGBBBBB
Fill Colour 2 0-0xFFFF RRRRRGGGGGGBBBBB
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x43 Answer ID


OLED Draw Circle

This command will draw circle

Field Size (byte) Value Description
OPCODE 1 0x44 Operation code
OLED ID 1 0-2 OLED device number
Col of centre 1 0-127
Row of centre 1 0-127
Radius 1 0-127
Line Colour 2 0-0xFFFF RRRRRGGGGGGBBBBB
Fill Colour 2 0-0xFFFF RRRRRGGGGGGBBBBB
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x44 Answer ID

OLED Copy

This command will Copy the rectangular region defined by the starting point and the ending point to location. If the new coordinates are smaller than the ending points, the new image will overlap the original one.


Field Size (byte) Value Description
OPCODE 1 0x45 Operation code
OLED ID 1 0-2 OLED device number
Col start 1 0-127
Row start 1 0-127
Col end 1 0-127
Row end 1 0-127
Col new start 1 0-127
Row new start 1 0-127
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x45 Answer ID


OLED Clear

This command will sets the window area specify by starting point and the ending point to clear the window display.


Field Size (byte) Value Description
OPCODE 1 0x47 Operation code
OLED ID 1 0-2 OLED device number
Col start 1 0-127
Row start 1 0-127
Col end 1 0-127
Row end 1 0-127
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x47 Answer ID


OLED Set Fill Mode

This command will enable or disable filling of colour into rectangle in draw rectangle command.

Field Size (byte) Value Description
OPCODE 1 0x48 Operation code
OLED ID 1 0-2 OLED device number
Fill mode 1 0-1 0: Fill mode off 1: Fill mode on
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x48 Answer ID


OLED Text Box

This command will set text box size for command “Print String”.


Field Size (byte) Value Description
OPCODE 1 0x53 Operation code
OLED ID 1 0-2 OLED device number
Col start 1 0-127
Row start 1 0-127
Col end 1 0-127
Row end 1 0-127
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x53 Answer ID


OLED Print string

This command will print string in the area set by command OLED TEXTBOX(0x53).

Field Size (byte) Value Description
OPCODE 1 0x56 Operation code
OLED ID 1 0-2 OLED device number
String 1-1023 ASCII String to be printed
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x56 Answer ID


OLED Draw Picture

This command will draw a bitmap picture.

Field Size (byte) Value Description
OPCODE 1 0x60 Operation code
OLED ID 1 0-2 OLED device number
Col start 1 0-127 Column start address
Row start 1 0-127 Row start address
Picture ID 1 0-3 0: Uni Logo 1: Dog’s left eye 2: Dog’s right eye
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x60 Answer ID


OLED Draw Battery Bar

This command will draw the battery bar on right screen.

Field Size (byte) Value Description
OPCODE 1 0x64 Operation code
Battery Value 1 0-100 Battery value(total 5 bars) 0: empty 100: full
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x64 Answer ID


OLED Move Eyes

This command will move dog’s eyes.

Field Size (byte) Value Description
OPCODE 1 0x66 Operation code
Left OLED Posn 1 0-13 There are total 13 positions. 0: 0 o’clock while 11: 11 o’clock,

12: is the centre of the eye, and 13: is Random positions

Right OLED Posn 1 0-13 There are total 13 positions. 0: 0 o’clock while 11: 11 o’clock,

12: is the centre of the eye, and 13: is Random positions

Answer Command
Field Size (byte) Value Description
Answer ID 1 0x66 Answer ID


OLED Draw Eyes

This command will clear the old eyes and draw dog’s eyes in the new address.

Field Size (byte) Value Description
OPCODE 1 0x67 Operation code
Col (left) 1 0-127 Left eye centre column address
Row (left) 1 0-127 Left eye centre row address
Col (right) 1 0-127 Right eye centre column address
Row(right) 1 0-127 Right eye centre row address
Answer Command
Field Size (byte) Value Description
Answer ID 1 0x67 Answer ID

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 ‘section 6’ to the board and even update the firmware image.

OLED_Board

PB0701 Dual OLED Board

The Dual OLED board, PB0701, is a very simple board that contains circuitry to boost the DC input voltage to 12V which is required by the OLED’s. Other than that, the board simply takes signals from the head based ATMega128 and routes these to the required pins on the OLED’s connector.

The OLED’s used for the eye’s are Univision UG-2828GXXXF01 with 128RGB x 128 pixel resolution. This particular OLED uses a SSD1339 graphics controller with built in graphic acceleration functions. Via the head based ATMega128 it is possible to display any type of information, graphics or text.


HyInt Head.jpg
Dual OLED Board mounted in HyKim's Head

Hardware

Documentation

Schematics:
Datasheets:

Sensor_Board

PB0702 Capacitive Touch sensors Board

The Sensor board, PB702, is simply 3 Capacitive Touch sensors with LED confirmation.

This board is located under HYKIM’S chin, as shown in the image below. The board uses a Quantum Research QT240-ISSG ic to detect ‘touches’, this ic provides TTL level outputs which are sent to the Head Data Acquisition module via J1.


HyKim HeadSenseButtons.jpg
PB702 mounted horizontally at the bottom of HYKIM’S head

Hardware

Documentation

Schematics:
Datasheets:

To Do (v2)

Things that need to be done to complete this document:

  1. expand What's included with HyKim section in the Introduction
  2. complete the Safety section (Section 2)
  3. add link to latest Debian Etch image
  4. add sample code for CM-iGLX
  5. add links to source code and firmware for Body Data Acquisition Board (RM0604)
  6. add links to source code and firmware for Head Data Acquisition Board (RM0605)
Personal tools