CAN ADC format

A forum for discussing the MegaSquirt related (but non-B&G) board development, assembly, installation, and testing.

Moderators: jsmcortina, muythaibxr

Post Reply
lutorm
Helpful MS/Extra'er
Posts: 146
Joined: Sat Apr 11, 2015 2:53 pm
Location: The island of Hawaii

CAN ADC format

Post by lutorm »

Hi all,

I've been playing around with sending ADC sensor data to my Microsquirt over the CAN bus from an Arduino. I believe I have the data flowing correctly, the Arduino responds to the requests and if I set the baro or O2 sensors to "Remote ADC x" they react to different values. However, I can't seem to figure out what the scaling is.

My immediate thought was that 0x0000 would be like "0V" and 0xffff "5V". However, the baro sensor seems to scale as one count being 0.01kPa regardless of how the calibration is set. And the lambda readout is completely nuts, flipping all over the place.

Is the expected scaling for the different sensors documented anywhere?

Thanks,

/Patrik
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: CAN ADC format

Post by racingmini_mtl »

Sensor ADC inputs are assumed to be 10-bit values. The reason for this is that the MS2 ADC inputs are 10-bit values (0-1023). And the calibration is also working on that assumption.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
lutorm
Helpful MS/Extra'er
Posts: 146
Joined: Sat Apr 11, 2015 2:53 pm
Location: The island of Hawaii

Re: CAN ADC format

Post by lutorm »

Aaaah! 8)

Now the baro numbers make perfect sense, thanks! The only funny thing is that the reading apparently doesn't saturate at 1023, it keeps on going if you send a higher number.

However, I can't find the O2 sensor calibration anywhere. I was confused about this before, too. Surely it must exist somewhere?
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: CAN ADC format

Post by racingmini_mtl »

Unlock calibration and calibrate AFR table in the tools menu.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
lutorm
Helpful MS/Extra'er
Posts: 146
Joined: Sat Apr 11, 2015 2:53 pm
Location: The island of Hawaii

Re: CAN ADC format

Post by lutorm »

Ah, perfect! The "AFR table" didn't sound like a sensor calculation. so I never checked that option out.

Thanks! All is good now. :D
lutorm
Helpful MS/Extra'er
Posts: 146
Joined: Sat Apr 11, 2015 2:53 pm
Location: The island of Hawaii

Re: CAN ADC format

Post by lutorm »

I'm really pleased at how easy it was to get this working, actually. I'm using an Arduino Pro Mini, a MCP2515 can controller and a MCP 2551 transceiver. This is the same hardware that's on the Arduino can-bus shield, only the bare components are $3.50 as opposed to the $40 for the shield. And apart from 2 resistors, that's all that was needed -- you can clock the 2515 off the Arduino clock output, so you don't really need a separate crystal, and I'm not interested in the other hardware on the shield. Total hardware cost, something like $12! I'll probably spend more money than that on finding a waterproof case and connector... 8)
deg87
MS/Extra Newbie
Posts: 1
Joined: Fri Dec 06, 2019 1:29 am

Re: CAN ADC format

Post by deg87 »

hi, I know this topic is old, but it matches what I'm trying to do too. I found mscan library created by lutorm, I'd like to use it but I didn't find any documentation or example files, could anyone help? :RTFM:
Post Reply