Sie sind auf Seite 1von 25

Dept.

of Mechatronics and
Medical Engineering

Implementing the CANopen Protocol


and a new Interface with
Communication via Bluetooth in the
BioBike
July 2014

Project Report
Vedant Prusty
Intern/Praktikum, May-July 2014
vedprix@gmail.com
Dept. of Mechatronics
Manipal Institute of Technology,
Manipal 576104; INDIA.

Betreuer:
Prof. Dr. Ing Rainer Brucher
Dipl. Ing Volker Schilling-Kstle

1|Page
Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

Contents

Introduction........................................................................................................................................ 3
Existing Structure: ............................................................................................................................... 3
Aim: ..................................................................................................................................................... 5
The CANopen Protocol:....................................................................................................................... 5
Device model ...................................................................................................................................... 5
Signal Characteristics ...................................................................................................................... 6
Message formats............................................................................................................................. 6
Implementing CANopen in the BioBike: ............................................................................................. 8
Project BB_Motor: .......................................................................................................................... 8
Project CANopenCom.X ................................................................................................................ 11
BioBike Qt Project ...................................................................................................................... 14
End Position Switches: ...................................................................................................................... 17
Other Safety features for preventing motor overrun: .................................................................. 18
Optical Encoder at the Pedal (Drehzahl) system: ............................................................................. 18
Connection assignment on PCB .................................................................................................... 19
Power Module: ................................................................................................................................. 19
Designing and assembling the new Interface PCB: ........................................................................... 20
The New PCB: ................................................................................................................................ 21
CAN: .............................................................................................................................................. 21
Pedal System (Drehzahl): .............................................................................................................. 22
Power: ........................................................................................................................................... 22
Bluetooth: ..................................................................................................................................... 22
LED: ............................................................................................................................................... 22
Casing: ........................................................................................................................................... 23
Future Work and Prospects: ............................................................................................................. 24
Bibliography & Reference: ................................................................................................................ 24
Acknowledgements:.......................................................................................................................... 25

Vedant Prusty (vedprix@gmail.com) 2|Page


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

Introduction

The BioBike being developed at Hochschule Ulm is a device which can be used to assess a
drivers performance. It employs various modules including assessing and controlling seat
and handlebar position and height, the angular velocity of the pedal, power brakes, etc.
Additionally, the project holds great prospects in the field of physical rehabilitation, given the
systems ability to analyze human performance and respond accordingly. This project BioBike
has the objective of developing a special test bench for bikers, covering biomechanics,
effective pedaling and optimal power consumption.

The BioBike project which began in 1994 has been divided into a no. of Bachelor projects
and has been worked upon continuously. The Aim of this author has been to implement the
CANopen communication protocol (replacing simple serial communication) to communicate
with the various motors in the device. The second goal was to replace the existing
independent hard wired connections from the various modules of the BioBike to the PC with
a single master PCB which is able to accept all data from these modules and transmit it to the
PC via Bluetooth.

The Bio Bike in development, Medical Electronics Laboratory,


Hochschule Ulm, July 2014

Vedant Prusty (vedprix@gmail.com) 3|Page


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

Existing Structure:
The BioBike consists of 4 motors controlling the following:

Seat Position Up/DOWN


Seat Position Forward/Backward
Handlebar Position Up/Down
Handlebar Position Forward/Backward

These motors are controlled by microcontrollers. Potentiometers which movie parallel to the
above components are able to return an analog value to the microcontroller, which uses and ADC to
convert this to a value signifying the position of the component. The individual microcontrollers then
send back this information to the Master Microcontroller which in turn is connected to the PC. The
user can send commands for movement of various parts through a user interface in the PC made
using Qt.

Qt is a cross-platform application framework that is widely used for developing application


software with a graphical user interface (GUI) (in which cases Qt is classified as a widget toolkit), and
also used for developing non-GUI programs such as command-line tools and consoles for servers.

Qt uses standard C++ but makes extensive use of a special code generator (called the Meta Object
Compiler, or mac) together with several macros to enrich the language.

The Qt interface sends back information to the Master microcontroller for controlling individual
motors.

The Microcontrollers to control the motors, the interface, etc. are all programmed using MPLAB X.

MPLAB Integrated Development Environment (IDE) is a free, integrated toolset for the
development of embedded applications on Microchip's PIC and dsPIC microcontrollers. In addition to
its predecessor's functionalities and compatibility with Microchip's existing development tools, the
new MPLAB X IDE utilizes many NetBeans features allowing for user-interface improvements and
performance upgrades.

Besides this, the BioBike consists of various other components including the Power Brake,
the Pedal Force analysis system, the Pedal Angular Velocity Analysis System. These systems send
back data independently to the PC via hard wire connections.

Vedant Prusty (vedprix@gmail.com) 4|Page


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

Aim:
The Aim of this project has been to replace the existing individual connections from the
various components to the PC with a single microcontroller attached to the central stationery
module. This microcontroller is mounted on a PCB and transmits signals coming from all
independent motor and Pedal devices to the PC via a Bluetooth module.

This removes the requirement of proximity required by limitations of the hard wire connection to
the PC.

The other goal of this project has been to replace the existing Serial Communication protocol being
used to communicate with the motors with the CANopen protocol.

CANopen is a communication protocol and device profile specification for embedded systems used in
automation. In terms of the OSI model, CANopen implements the layers above and including the
network layer.

The CANopen Protocol:


The CANopen standard consists of an addressing scheme, several small communication
protocols and an application layer defined by a device profile. The communication protocols have
support for network management, device monitoring and communication between nodes, including
a simple transport layer for message segmentation/desegmentation. The basic CANopen device and
communication profiles are given in the CiA 301 specification released by CAN in Automation.

Device model
Every CANopen device implements certain standard features in its controlling software.

A communication unit implements the protocols for messaging with the other nodes in the
network
Starting and resetting the device is controlled via a state machine. It must contain the states
Initialization, Pre-operational, Operational and Stopped. The transitions between states are
made by issuing a network management (NMT) communication object to the device.
The object dictionary is an array of variables with a 16-bit index. Additionally, each variable
can have an 8-bit subindex. The variables can be used to configure the device and reflect its
environment, i.e. contain measurement data.
The application part of the device actually performs the desired function of the device, after
the state machine is set to the operational state. The application is configured by variables in
the object dictionary and the data are sent and received through the communication layer.

CANopen devices must have an object dictionary, which is used for configuration and communication
with the device. An entry in the object dictionary is defined by:

Index, the 16-bit address of the object in the dictionary


Object name, a symbolic type of the object in the entry, such as an array, record, or simple
variable

Vedant Prusty (vedprix@gmail.com) 5|Page


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

Name, a string describing the entry


Type, gives the datatype of the variable (or the datatype of all variables of an array)
Attribute, which gives information on the access rights for this entry, this can be read/write,
read-only or write-only
The Mandatory/Optional field (M/O) defines whether a device conforming to the device
specification has to implement this object or not

Signal Characteristics

CAN may be implemented over a number of physical media so long as the drivers are open-
collector and each node can hear itself and others while transmitting (this is necessary for its
message priority and error handling mechanisms). The most common media is a twisted pair 5v
differential signal which will allow operations in high noise environments and with the right drivers
will work even if one of the wires is open circuit. A number of transceiver chips are available the
most popular probably being the Philips 82C251 as well as the TJA1040.

Message formats

The CAN protocol uses a modified version of the Carrier Sense Multiple Access/Collision
Avoidance (CSMA/CA) technique used on Ethernet. Should two messages determine that they are
both trying to send at the same time then instead of both backing off and re-trying later as is done
with Ethernet, in the CAN scheme, the transmitters detect which message has the highest priority

Vedant Prusty (vedprix@gmail.com) 6|Page


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

and only the lower priority message gets delayed. This means that a high priority message is sure of
getting through.

The CANopen message frame


Data Frames

These are the normal message frames used to carry data. They contain the following fields (this is
a simplified description as the controller takes care of the detail)

Start of frame (SOF)


Message Identifier (MID) the Lower the value the Higher the priority of the message
length is either 11 or 29 bits long depending on the standard being used
Remote Transmission Request (RTR) = 0 ----- see "Remote Frames" para below for
non-zero value
Control field (CONTROL) this specifies the number of bytes of data to follow (0-8)
Data Field (DATA) length 0 to 8 bytes
CRC field containing a fifteen bit cyclic redundancy check code
Acknowledge field (ACK) an empty slot which will be filled by any and every node that
receives the frame
it does NOT say that the node you intended the data for got it, just that at least
one node on the whole network got it.
End of Frame (EOF)

The way in which message collision is avoided is that each node as it transmits its MID looks on the
bus to see what everyone else is seeing. If it is in conflict with a higher priority message identifier
(one with a lower number) then the higher priority messages bit will hold the signal down (a zero bit
is said to be dominant) and the lower priority node will stop transmitting.

Remote Frames

These are frames that are used to request that a particular message be put on the network - of
course a node somewhere on the network has to be set up to recognize the request, get the data
and put out a Message frame. This mechanism is used in polled networks.

Why Use Can?

Vedant Prusty (vedprix@gmail.com) 7|Page


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

With the new CANopen protocol implemented, it is expected that adding other modules such as
sensors and actuators for ECG, pulse oximetry, ergometrics, etc. in the future is made easier due to
the standard communication protocol.

Implementing CANopen in the BioBike:


The Bio Bike project had CAN implemented to a certain extent in the MPLAB
(microcontroller) and Qt (PC interface) projects. The task was to completely include CANopen and
run the four motors for position using this new code. This meant modifying and adding to the
existing code. (Each motor controller in the BioBike acts as a node in the CAN bus)

The changes done on the microcontroller project through MPLAB were on the project
named CANOpenCom.X. This program controls the master microcontroller. Also, the BB_Motor
program was worked upon, which controls individual motor controllers.

In Qt, the PC interface program under the project name Bio Bike was modified. This included
adding new commands for movements, editing movement control accordingly to implement
CANopen, and editing the user interface window.

The codes for the above are explained briefly below. The complete code is attached with this
documentation.

Project BB_Motor:

This project holds the code for the individual motor microcontrollers. It defines device ID for
the node in the CAN bus, and protocols for building, sending and receiving CANopen messages over
the network.

Two new status flags were added. newPosition and isMoving. This was implemented so that the
controller returns the value of the potentiometer under following conditions:

The device has a new position


The device is moving

While starting to move the motor, the isMoving flag is set to 1, and is set to 0 every time the motor
is halted.

Vedant Prusty (vedprix@gmail.com) 8|Page


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

If a CAN message is received to control motor, the


corresponding motor control function is called and the
isMoving flag is set accordingly.

In the bbMotor_main.c file, a check is made to see if newPosition flag is activated. Accordingly, a
process data object or PDO is built and sent over the CAN network to the PC. The flag newPosition is
then reset to 0.

Vedant Prusty (vedprix@gmail.com) 9|Page


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

The main() function checks for motor status before sending out_msg

The presence of a new potentiometer value generates an interrupt


In bbMotor_intr.c, the file used
for defining the interrupts to the
code, a check is made on ADRES,
which hold the potentiometer
value. If a new value is detected,
an interrupt is generated.
actual_positon is set to ADRES
value and the newPosition flag is
activated. (which gets detected in
the main function as explained
above.

In the final stages of the


project, it was detected that as
soon as the power supply was
connected, the motor
microcontrollers started sending
information over the CAN
network. This led to severe traffic
over the network, considering CAN messages from 4 controllers. The reason was identified as
follows: the potentiometers may return non-distinct values, or values between two numbers, an
interval which the uC cannot recognize, and therefore considers them as moving. It then keeps
sending CAN messages of apparent new positions of potentiometers. (It is also possible that the
potentiometer itself keeps oscillating between two values and keeps updating the input value latch
in the uC) To prevent this from happening, the isMoving flag variable is initialized to 0 in the _init()
function in bbMotos_main().c

Vedant Prusty (vedprix@gmail.com) 10 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

Project CANopenCom.X

This project holds the code for the master microcontroller installed on the new Interface,
which is able to communicate via Bluetooth with the PC. The project is essentially a standard CAN
communication project used at HS-ULM, which has been modified to suit the needs and
requirements of the BioBike.

In the CANcomm.h header file, various CAN message command IDs have been defined, including
definitions for CAN message in, out, device, version requests, etc. the on and off states of the LED
meant to display CAN message data activity on the Interface board have also been defined here.

In the can.c source file, the writeCAN_BO() function is used to write the CAN message into the
transmit latch from the out_msg variable.

The writeCAN_BO() function is used to write to the


transmit latch

(in_msg and out_msg are variables of the user defined structure type CAN_MSG, defined in can.h
which hold the incoming and outgoing CAN messages respectively. They are defined in the standard
can.c. the can.h and can.c files are used commonly on all devices in the BioBike. )

In the CANcomm_main.c source file, the buffers BUF0 and BUF1 of the microcontrollers are checked
for incoming odd and even addressed CAN messages, and overflow in the presence of the messages
using RXB0CON.RXFUL and RXB1CON.RXFUL. at this time, after the PC_inPck (which is used to send
the incoming CAN message to the PC) is built, the mTOG_LED is used to toggle the CAN data LED.

Vedant Prusty (vedprix@gmail.com) 11 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

It is to be noted here that as explained above in the BB_Motor project, initial traffic was
detected on startup of uCs. As soon as a connection was made to power, the master microcontroller
started receiving and transmitting CAN messages from the motor controllers to the PC. This led to
interference with the initial messages of device ID and device recognition by the Qt program. (It was
overwhelmed by CAN messages of potentiometer values, and the program had a tendency to hang).
To prevent this, besides initializing isMoving flag to 0 in the BB_Motor project, a check is made to
see if device has been started (errors.not_started flag should be 0) (i.e. a connection has been
established with PC). Only then does it the program allow receiving and transmitting the messages
from the motor controllers.

The check on startup prevents data traffic in the CAN bus

Vedant Prusty (vedprix@gmail.com) 12 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

Building the out CAN message from


the PC_out_pack message

The definition of CAN instructions

Vedant Prusty (vedprix@gmail.com) 13 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

BioBike Qt Project
The old User Interface in the Qt program.

The BioBike project in Qt


holds code (in C++) for the PCs
communication with the remote
microcontroller. It defines the
various functions to send messages
for moving motors in various
directions and reading their
positions. It also defines a User
Interface, which may be run as an
executable file on building the
project. The user interface designed
had all basic commands for motor
control and is simple to use.

The present User Interface with a text widget for Target Position

The BioBikeCAN.h header file in the Qt project has definitions for various CAN message commands,
controls, status, operations and device IDs; corresponding to the same definitions on the
microcontrollers.

Vedant Prusty (vedprix@gmail.com) 14 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

The BioBike_main.cpp connects various buttons on the UI to functions. It also defines functions for
connecting to the remote interface through the COM ports of the PC.

It is able to build CAN messages for UP/Down and Forward/Backward controls entered through
buttons. It is able to process incoming CAN messages and analyze potentiometer data, in order to
display the Seat or Handlebar position on sliders on the UI.

Example Working of a motion buttons:


When the Handlebar UD button move the handlebar upwards is clicked, a CAN message is
built with instructions for the respective motor to move upwards. ( BB_LENKER_UD device ID,
BBMC_MOVE_MINUS message data, and BBM_CONTROL message object). As soon as the button is
released, the message data is set to BBMC_HALT and a new CAN message is sent over the network.

Vedant Prusty (vedprix@gmail.com) 15 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

The on_btnStopAll() function is called on clicking the Emergency Stop All button. In turn, it
calls the STOP functions of all the motors consecutively. The function is meant as a safety and
proved useful while running tests in the course of the project.

The biobike.ui file holds the UI. As explained earlier, it has basic buttons for motor control inside a
central widget. Vertical and horizontal sliders display positions for the 4 motors based on
potentiometer reading. There is also a slot for entering absolute target position for a specific motor.
The radio button for the desired motor is selected, the value is entered and the GoTo button is
clicked.

The on_btnGoTo function decides the direction in which the motor must
move based on potentiometer reading and the value entered by user.

(It is to be noted that even though provisions are made in the embedded program to receive target
positions for motors, this is not implemented. In this project, the PC or Qt program sends a motor
PLUS or MINUS message based on present position of the potentiometer (in the incoming CAN

Vedant Prusty (vedprix@gmail.com) 16 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

message) and target position entered in the UI. As soon as the required position is reached, the
program sends a HALT message to the motor.)

When a CAN message is received by the PC, the sender is identified via
cobID, the display slider is set to the incoming potentiometer value, i.e.
potival, and then it is checked with target value entered by user to
determine if motor should be stopped.

End Position Switches:


Each of the 4 motors has two end
Parallel Connection of the switches to position micro-switches installed along the
the motor power supply on the motor tracks of the kinetic module. Hence, for
controller board example, if the handlebar were to keep
moving forward, it could eventually cross the
limit of the BioBIke and cause damage. To
prevent this, the end position micro-switch is
connected in series with the O/P voltage to
the motors in the PCB. This automatically
disconnects the motor power supply.

Once the circuit is open, further


commands sent to the motor controllers are
useless, since the power to motors is cut off.
At this point manual control is introduced by
the user pressing down on switches, which
are attached in parallel to the end position
micro switch. Thereby, the circuit is
completed and the module can return to a
safe position under supervision.

Vedant Prusty (vedprix@gmail.com) 17 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

The micro switch and the


Other Safety features for preventing motor overrun: manual switch along the
Handlebar UD system
The aim should be never to require the end position switches to
come into action. They are meant only as standby for emergencies. To
implement this, the software in Qt has internal limits set. Thereby, the user is
instructed to enter Target values for motor positions only within certain safe
limits.
Through the embedded program, The microcontrollers are also expected to
stop supply to the motors if the potentiometer value reaches certain limits.
To top this, the Emergency Stop All button in the Qt UI provides
option to manually stop all movement.

Optical Encoder at the Pedal (Drehzahl)


system:

The crank or pedal of the BioBike uses an Optical Encoder or Winkelgeber to analyze information
regarding the angular velocity, angular acceleration, and direction of rotation of the pedal. Based on
this, the Power Brake may be actuated as necessary.

The existing system on the BioBike is the result of another bachelor Project which installed the
GA210 Optical Absolute Encoder from IVO. It is a singleturn encoder with 10 parallel outputs. (Later
in this document, it is explained how the 10 data bits are connected to the master interface on the
PCB.) The encoder has a 5V DC input.

The previous project used a 23pin Female Sub D connector


to relay information to the PC . The project used a
dedicated PCB, wire connection and microcontroller
program to handle data coming from the pedal and analyze
it. However, it was the aim of the BioBike project to have an
integrated and well-connected system. Therefore, the
Drehzahl system had to be incorporated into the Master
interface.

For this purpose, the Female 23pin Sub D coming from the Encoder was replaced with a 15pin
Female SubD connector (optimizing the use of available pins) , and this was connected to the
Master Interface PCB. (The Interface has a 16 pin connector on the PCB, which is connected to a
Male 15 pin connector on the casing) Other than the 10 data pins, GND and power connections, pins

Vedant Prusty (vedprix@gmail.com) 18 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

for rotation direction (pin 14) etc. were also connected. The ENABLE (pin 13) (active LOW) and
STORE (pin16) were grounded.

On the PCB, pins 15, 13 and 16 from 16 pin connector are grounded. Pin 11 is connected to 5V
supply. Accordingly, the connections in the sub D need to be modified in a future project which
integrates the angular velocity data acquisition into the Master Interface.

The microcontroller on this new PCB is designed to handle data for CAN communication, the optical
encoder as well as the power brake, as explained later.

Connection assignment on PCB:


ConnPin Cable Color Assignment PIC Pin

1 violet 20 / G0 RA0
2 white/brown 21 / G1 RA1
3 white/green 22 / G2 RA2
4 white/yellow 23 / G3 RA3
5 white/gray 24 / G4 RA5
6 white/pink 25 / G5 RA7
7 white/blue 26 / G6 RA6
8 white/red 27 / G7 RC0
9 white/black 28 / G8 RC1
10 brown/green 29 / G9 RC2
11 green/yellow NULL +5V
12 blue GND RC3
13 yellow ENABLE GND
14 brown UP/DOWN RC4
15 red UB GND
16 pink STORE GND

TK PS 2518-8f-to

Power Module:
The BioBike is powered by an
independent Power Module, the SP320-
24 from MeanWell. The module takes 88
to 264V AC and gives and output of 24V
through parallel connections. This

Vedant Prusty (vedprix@gmail.com) 19 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

module was put inside a casing (TK PS 2518-8f-to). Holes were drilled in the casing for Power input,
and supply to motors and the Power Brake.

The power module has been mounted


on the central stationery module of
the BioBike.

Designing and assembling the new Interface PCB:

Independent connections coming from the BioBike to the PC make the system bulky and
complicated. Moreover, this does not allow handling all the various signals at a time. There was a
need to implement a single transmission device. This gave two major advantages, the BioBike system
could be controlled via Bluetooth at a distance, and all the different signals from the various
components of the device could be handled at a time.

The Existing model of the BioBike was as follows.

The old serial communication module


with the master microcontroller

Vedant Prusty (vedprix@gmail.com) 20 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

The New PCB:


The designing of the
New PCB was done using
Electronic Design Automation
software, Eagle 6.5. The PCB
was then manufactured In
House after several changes
and corrections to suit
manufacturing and device
limitations.

CAN:

The new system to be implemented was to have Bluetooth Communication with PC via
Bluetooth. There are two CAN ports on the new PCB, one for the Power brake and one for the Motor
Controllers. The PC sends information to the microcontroller via Bluetooth. The microcontroller then
transmits the CAN message via the dedicated CAN pins available on the PIC 18.

Since the nodes or devices in a CAN network are able to identify whether the message is meant for
them or not (using the message address and device ID), only a single CAN message needs to be
generated in a common communication line used by the Motor controllers and the Power brake.

Vedant Prusty (vedprix@gmail.com) 21 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

Pedal System (Drehzahl):

There is also a port for communication with the


Drehzahl (no. of revolutions) or Pedal System. The
Pedal System employs 10 bits of communication
data sent from the optical encoder. Therefore, a
15 pin connector was selected for the PCB.

Manufacturing the Interface board in-house

Power:
The Input Power from the existing Power
Port was 24V. This level had to be converted
to 5V and 3.3V in two phases using Voltage
regulators, resistors and capacitors. The 5V
is used by the main PIC master
Microcontroller. The 3.3V by the Bluetooth
Module on the PCB.

Bluetooth:
The Bluetooth module uses a WT12-A
chip from BlueGiga technologies. It comes
as a readymade module from HS Ulm.
Therefore, a jumper port with relevant
connections for Tx (transmit) and Rx
(Receive) was made on the PCB.
The WT12-A Bluetooth chip

LEDs:
3 LED indicators are used for indicating the following

Yellow LED for Power Supply (connected at 5V)


Blue LED for Data Connection of Bluetooth. (Connected to Bluetooth module)
Green LED for CAN data connection. (Connected to master Microcontroller)

Vedant Prusty (vedprix@gmail.com) 22 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

The decision to include LEDs was important. In the initial assembly stage, the LEDs proved
useful in detecting power fluctuations in the board, and thereby helped in troubleshooting
connection problems. The yellow LED is programmed to toggle every time a CAN message is
received by the Interface. Hence, it is an indication of the amount of traffic in the CAN bus,
which was reduced overtime by changing the embedded programs algorithm for sending and
receiving CAN messages. Since the main power module does not have LEDs on the casing, the
LED on this PCB also serves to indicate Power Supply to the whole BioBike.

The Interface PCB after all SMDs and


connectors soldered, the PIC
microcontroller and the Bluetooth
module in place

Casing:
A Hammond 1554C casing with transparent cover was used to house the
interface. Two holes were drilled on the right side for CAN and power
lines, while a SUB D 15 Male connector is mounted on the lower side
for connection to the SUB D Female coming from the Optical Encoder of
Pedals.

Vedant Prusty (vedprix@gmail.com) 23 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

Future Work and Prospects:

The new PCB interface has been manufactured and installed, but it is yet to be programmed
with codes for Power Brake and the Optical Encoder from Pedal. This will involve taking
microcontroller codes from all the other independent modules and compiling them into one
project in MPLAB and Qt.
The 4 pin power-cum-CAN input to the Interface needs to be realized. This will require
implementing CANopen protocol in the Power Brake, and adding it to the CAN network. (As
of now, of the 4 pins, only 2 pins are connected and supply power to the Interface module)
As mentioned earlier, the BioBike is in continuous development. Since the CANopen protocol
has been implemented, communication with new modules is much easier and standardized
now.
Sensors are yet to be built into the BioBike. Pulse sensors, EMG signal sensor modules, etc.
can be added to better analyze driver performance.
To check proximity between the Handlebar and the Central stationery module, limits can be
implemented through functions in the Qt PC program. This will prevent possible collision
between these modules.
Implementation of the use of actual_position and target _position variables in
microcontrollers so that motor uC can directly receive target position and control motors
accordingly. Similarly, the status variables for denoting end position reached can be
implemented into code.
An innovative step in the project would be to be able to store person-specific-values for the
positions off various motors in .txt or similar file formats. The file can then be read and the
values can be entered automatically by the program as target positions for the various
motors.

The completed Interface with Bluetooth communication, installed on the


central module. The Yellow LED indicates power supply, while the blue LED
indicates a serial connection with the Bluetooth module.

Vedant Prusty (vedprix@gmail.com) 24 | P a g e


Implementing CANopen in a new Interface in the BioBike Hochschule Ulm July 2014

Bibliography & Reference:

Matthias Ebenhoch, Tim Stricker, Erik Weber (Summersemester 2013) Vorgabe eines
Fahrprofils mittels einer Bremmsteuerung BRAKE POWER
Pascal Goll, Willi Konrad (June 2013) (Drehzahlerfassung B 13) Erfassung der Drehzahl
mit Absolut-Drhgeber ber CAN-Bus mit PIC Mikrocontrollersystem PEDAL
Eva Witzel, Gabriel Scheremet, Manuel Glashauser (Summersemester 2013) Mobiler
Ladungsverstrker fr Pedal-Kraftmessung zur Tritttechnik-Erfassung, Technische
Documentation PEDAL FORCE

Volker (May 2014) Assembler & C mit MPLAB-X (Einstieg in die Programmierung von
PIC18Fxxxx Mikrocontrollern)
COMSOL CAN- a brief tutorial for Embedded Engineers (web)
Sirius microSystems MPLAB tutorial

Acknowledgements:

This project would not have been possible without the support (even before the internship)
and encouragement of Prof. Dr. Rainer Brucher, under whose guidance the whole internship
was planned and carried out.

My sincere thanks to Volker Schilling-Kstle, for his constant guidance and help at every step
of this project; and for showing me that there are always different possibilities!

I saw something I could never forget. I saw lifetimes of acknowledgement, fear,


wisdom, questioning, and understanding in their eyes. It was an experience worth;
Thank You Dr. Patrick Kluger and Marie Theres Grfin Adelmann for everything!

Vedant Prusty (vedprix@gmail.com) 25 | P a g e