Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Motorcycle Data Acquisition and CAN-Bus.

Status
Not open for further replies.

gowenwilliams

New Member
Hi all..

I am building an extended range of sensors for a data logging system on a race motorcycle. It consists of a number of multi axis accelerometers and gyro units which output analouge signals in the 0-5v range.. These can directly interface with my current logger and all is fine...

The problem.. When I am running all the other suspension, wheel-speed, tyre temp, etc sensors, I run out of analogue inputs on the logger.

The solution.. Well, the logger can also log an extra 32 data channels using CAN-bus, and we have achived this successfully with commercially available CAN compatible hardware... But how do I interface my 'cheap and nasty' 5V analogue gyro's and loggers with the loggers CAN bus?

Looking on various RS catalouges etc I guess that this is going to be achived using a PIC microcontroller and Some A/D conversion.

However my PIC/CAN knowledge is poor, and I'm a little stuck...

Any advice of how to get 0-5V analogue signals into CAN would be very much appreciated... :)

Thanks.

Owen
 
The answer is that you buy or build a CAN-bus module that has analog inputs. CAN itself is just a MAC layer protocol for getting data on and off the network pipe. It covers the syntax of data exchange without saying a word about the semantics. There are many systems that use CAN as an integral piece of the puzzle. In most cases there is an open specification that tells you what to do for the higher layers. DeviceNet, CAN-Open, and SAE J-1939 are three incompatible examples of things which are available. These specifications are available but they are not free.
 
Thaks for the advice so far.. but I need to understand the basics first...
Is this assumption correct:

Say I$have 8 analogue signals off various sensors (0-5V)..
Do I use a A/D converter approach to generate 8 digital channels..
Then feed these 8 digital input lines into a PIC which interfaces with my CAN?
Or does the PIC need to feed to a seperate CAN controller?
Sorry... but this is really not my field... but I'm getting very interested!! ;-)

Papabravo... You mentioned 'buy a CAN-bus module that has analog inputs'
I have looked for one of these, and besides the motorsport logger variety which retail for £1000's, I can't find something straightforward... I have found many things which 'could be' a CAN-bus module with analogue input, but I'm not sure really.. Does a cheap and simple analogue to CAN-bus interface exist? and if so, where can I get one?

Though over the last few weeks I have got interested in the challenge of building one... may do both!! :)
 
gowenwilliams said:
Thaks for the advice so far.. but I need to understand the basics first...
Is this assumption correct:

Say I have 8 analogue signals off various sensors (0-5V)..
Do I use a A/D converter approach to generate 8 digital channels..
Then feed these 8 digital input lines into a PIC which interfaces with my CAN?
Or does the PIC need to feed to a seperate CAN controller?
Sorry... but this is really not my field... but I'm getting very interested!! ;-)

Papabravo... You mentioned 'buy a CAN-bus module that has analog inputs'
I have looked for one of these, and besides the motorsport logger variety which retail for £1000's, I can't find something straightforward... I have found many things which 'could be' a CAN-bus module with analogue input, but I'm not sure really.. Does a cheap and simple analogue to CAN-bus interface exist? and if so, where can I get one?

Though over the last few weeks I have got interested in the challenge of building one... may do both!! :)
I would design a module to have as many analog inputs as you require, either on board the processor or in an SPI peripheral depending on the number of bits that you need. The digital values from the A/D converter would then be placed in CAN frames and sent over the network to another device which would record or display the values. When you refer to CAN-bus I'm not sure if you mean any generic device which uses CAN, OR if there is some required protocol defined by a specification which such a device must meet. This point is crucial to understanding what is involved in doing the development yourself.
According to this website:
**broken link removed**
you have a choice of the following higher layer protocols:
TTCAN, CANOpen, CAN Kingdom, DeviceNet, SDS, J1939, and CANaerospace / AGATE databus. So can we at least identify which one of these we are talking about? Then we can move on to the choices of datarates and connectors, assuming you can afford the cost of the protocol specification.
 
Last edited:
Thanks again for the info... things are getting clearer!!

I'm not aware that my logging device uses any special higher protocol, (which means it probably does and I'm unaware of it!? :)(
I have connected various CAN devices to it in the past and it logs ok.
When connecting it, we use 3 wires, CAN-Hi, CAN-Lo and GND
(It logs data as a graphical representation of the input channels with something like 0-65000 as a range, we then calibrate it back to the sensor reading in the software).

The company does not give much info about the CAN system.. all I've found so far is this....

--------

Both CAN Lines on the Logger can be used with different baud rates, bit timing and identifier size (11bit/29bit). This allows the user to connect to any CAN bus device or only to double the total CAN bus load by running additional sampling modules on two CAN lines.
The integrated routing function allows the User to route data from one CAN line to the other CAN line.

The Logger 6 generation does NOT have any limitation on the maximum recordable CAN Identifiers. The Logger is able to record the full CAN Bus data from 2 CAN Lines into the memory.
All channels can be configured individually for different sampling rates in a
range from 6.25 up to 1600 Hz.

-------------

Thanks..
 
gowenwilliams said:
Thanks again for the info... things are getting clearer!!

I'm not aware that my logging device uses any special higher protocol, (which means it probably does and I'm unaware of it!? :)(
I have connected various CAN devices to it in the past and it logs ok.
When connecting it, we use 3 wires, CAN-Hi, CAN-Lo and GND
(It logs data as a graphical representation of the input channels with something like 0-65000 as a range, we then calibrate it back to the sensor reading in the software).

The company does not give much info about the CAN system.. all I've found so far is this....

--------

Both CAN Lines on the Logger can be used with different baud rates, bit timing and identifier size (11bit/29bit). This allows the user to connect to any CAN bus device or only to double the total CAN bus load by running additional sampling modules on two CAN lines.
The integrated routing function allows the User to route data from one CAN line to the other CAN line.

The Logger 6 generation does NOT have any limitation on the maximum recordable CAN Identifiers. The Logger is able to record the full CAN Bus data from 2 CAN Lines into the memory.
All channels can be configured individually for different sampling rates in a
range from 6.25 up to 1600 Hz.

-------------

Thanks..
From the clues that you have given there is a bare possibility that no higher layer protocol is being used. There is not enough to design a node around however. I would need a more detailed specification of the device which is mapping the CAN identifier space, how or if remote frames are being used, how datarate is determined, and this mysterious bit about using the CAN lines (CAN-H and CAN-L) seperately. In short there appear to be way more questions then answers.
 
Next thing to understand is the PIC has a CAN_TX and CAN_RX pin, but these are NOT a CANBUS phy. To get a CAN_H and CAN_L, you must use a CAN transceiver. These are cheap and there are many types on Digikey, Mouser, and from Microchip (samples!) too.

The CAN transceiver is more than a simple level shifter like an RS232 transceiver. It separates out transmitted from received levels for one and the way CAN works you can't just hook up two chips' RX and TX without a transceiver like you could with the serial port. It's also differential, tolerates offset from ground, tolerates some serious high voltage, and has internal logic that tolerates microcontroller failure to avoid a stuck node that will disable the bus.
 
eng1 said:
The PIC18F258 and PIC18F458 have CAN tx and rx pins.

Right. But they're not a CANbus phy and you can't connect them to another CAN node directly. You must go through a CAN transceiver which has CAN_TX/RX on one side and CAN_H/L on the other (example: MCP2551). Only the CAN_H/L wires can connect CAN nodes together. No PIC that I know of has CAN_H and CAN_L pins.

Microchip and others DO make stand-alone CAN nodes, like the MCP2515. It can perform ADC and a bit of basic digital I/O. This particular one does not have a transceiver built in either though so you'd still need to include an external transceiver chip (like the MCP2551) to do that. I assume there are stand-alone CAN controllers out there that have the transceiver built-in.
 
Hey Owen,

I don't know anything about CAN. I know the PIC side of things and used to race 125s, got lots of datalogging exerience, sure together we could figure something out together. PM me

Rik
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top