Teensy CAN BUS outputs and inputs

Status
Not open for further replies.

Mike Elk

New member
I'm wanting to attach a Teensy to a small air conditioning unit that I'm working on that requires data output and inputs.
Data output is , temperatures, sensor data and amp draw via CAN BUS
Input is , turning unit on and off and turning power settings up and down via CAN

Which board /controller do I need for this and how would I go about making it work?
is there software I can use to program it and what hardware do I need to make this all work?


any help or advice would be much appreciated
 
I'm wanting to attach a Teensy to a small air conditioning unit that I'm working on that requires data output and inputs.
Data output is , temperatures, sensor data and amp draw via CAN BUS
Input is , turning unit on and off and turning power settings up and down via CAN

Which board /controller do I need for this and how would I go about making it work?
is there software I can use to program it and what hardware do I need to make this all work?


any help or advice would be much appreciated

Mike,

Many Teensy devices have CANBUS support built into the chip, but you still need to add the transceiver. Typically a one of these

A Teensy 4 and this board would provide the hardware: https://www.tindie.com/products/fusion/dual-can-bus-adapter-for-teensy-40-41/

Lots of other questions before you get to functioning hardware:
- Is this a one-off? Prototype? Will you be spinning up a custom PCB?
- Your user inputs (turning on/off, power up/down) would be switches? Do you need any LED indicators or text/graphics display?
- How do you want to power it?

The software is written in Arduino, using Teensyduino to program the Teensy. Have you used Arduino or C/C++before?

You will need to know the CAN protocol or reverse-engineer the CAN packets.
- Speed (kb/sec)
- 11bit or 29bit identifier
- What are the packet IDs?
- How is the packet data structured?
 
Thanks for your response ,

it is a prototype but will make a few before building our own boards.

don't need any led etc as there's an existing board that runs the unit we would just tap into this existing board with the existing analog inputs

theres a 12v power source to power it

haven't used any type of arduino programming software before

the can bus speed is around 1mp

not sure what packet data is?
and don't know identifier either
 
Last edited:
you'll have to hook it up to find out, primarily you need to know:

1) if it truely is a CAN bus on the AC
2) you need to know the baudrate in order to talk to it
3) you'll have to start logging/sniffing the frames on the bus to see which ones belong to on/off or temperature control, or even temperature readings may be on there as well

a datasheet of the AC unit will help you figure out the connection details but if your new to CANbus just make sure it really is supported before you start buying hardware for it
 
the AC isn't can bus but the car its going into is.

so the a/c pcb itself has analog plugs into it for this on/off and up /down

and I'm trying to connect it to CANBUS in a vehicle so i can operate it from the steering wheel buttons.

ive talked to the guys that are designing the canbus and there is actually 3 can buses in the vehicle

so i need to talk to them about baudrate too, correct?

then using a teensy 4.1 and canbus transceiver i can connect to ac unit using analog outputs on the teensy to turn these on/off and up/down
and connect canbus to transeiver to talk to vehicle.

but to talk the same language as the canbus , i will need to know baudrate and these you suggested :

"You will need to know the CAN protocol or reverse-engineer the CAN packets.
- Speed (kb/sec)
- 11bit or 29bit identifier
- What are the packet IDs?
- How is the packet data structured?"

Is this correct?

Thank you
 
You are going to have to reverse engineer the CANBus on the car, unless you have access to documentation. Firstly you will need to tap into the bus that carries the messages from the steering wheel buttons. Then you will need to sniff the bus while pressing the buttons to determine what gets sent when each button is pressed. Then you just need to write the code on the Teensy to listen for those messages and output the appropriate analog on/off up/down whatever.

A quick google search turned up this https://www.sans.org/reading-room/w...omobile-through-bus-reverse-engineering-37825
 
Yes, grab yourself a CAN to USB or CAN to SD data logger (tindie might have some) and look at the packets while you turn knobs and stuff.

For setup, you need to know bit rate (you said close to 1mbs). Options are typically 1mb/s, 500k, 250k, 125k. You also need to know the ID bit size, 11 or 29.

A CAN packet has an ID (typically 11 bits) and 0 - 8 bytes of data. There is also a Length value. Everything else (CRC, handshaking, ACKS, etc) is all handled by the hardware.

Once you start seeing packets, then try to make sense of them. If they obscure it or encrypt it, then you might be in for a bit of a challenge.

You could use Teensy hardware, but I'd get a off-the-shelf device so you are not debugging your hardware to get to do the reverse engineering.
 
Agree with TeensyWolf, a CAN bus analyzer like this one, saved me a lot of time while debugging a Teensy-based CAN bus device.

Paul
 
Status
Not open for further replies.
Back
Top