I fought the Max31856 and I WON

  • 5 Replies
  • 391 Views
*

Offline Rx7man

  • Crazy guy
  • Hero Member
  • *****
  • 908
  • Jack of all trades
    • '94 Dodge dually
I fought the Max31856 and I WON
« on: April 03, 2016, 10:27:34 PM »
Well.. after about 2 days of frustration, I think I've got it licked... I'd still like to do some optimizing, but so far so good..

Read 4 thermocouples in 200 MICROseconds... Not bad I think :).. and no sample smoothing is really necessary, the Max31856 can average up to 16 samples all by itself.

As long as the different chips all use the same SPI mode, that time can only get better with optimizations, but if I have to start changing SPI modes I might run into some extra code switching between them.

I will be revisiting my stepper motor as well, don't know if I'll ever actually use it for something useful though..


Next thing to attack will be the CAN bus, I want to put all SPI devices into one library, and have them all read/write the same way, and eliminate stuff we don't use (alternate CAN modes, etc)
'94 dodge, Colt Cam, head worked, NV5600, 3.55's, SB clutch, Ford manual hubs w. hawk brakes, custom flatdeck, custom aluminum bumper, cab off restoration, totally new engine, Mahle pistons @19:1..HE351VE with 67mm turbine and 67x95mm compressor
440hp/1000 ft lb @ 2400 RPM

*

Offline Rx7man

  • Crazy guy
  • Hero Member
  • *****
  • 908
  • Jack of all trades
    • '94 Dodge dually
Re: I fought the Max31856 and I WON
« Reply #1 on: April 04, 2016, 10:56:24 PM »
OK, though untested, it does compile with the addition of the CAN bus.

I modified the library to include only the barebones of what we need to work with the Holset turbo, and I added some shortcuts..

It makes working with the turbo MUCH easier, especially for someone not used to all this stuff..


A little example?

Code: [Select]
#include "MySPIdevices"

ThermoPin = 22;
CANpin = 10;

MAX31856 Thermo1(ThermoPin);
HolsetCAN Turbo(CANpin, VGTaddress); //CAN address of the turbo
 

setup(){
   Serial.begin(115200);
   Thermo1.begin();
   Turbo.begin();
}

loop(){
   Serial.print("Thermocouple is at (C) ");
   Serial.println(Thermo1.readThermocoupleC);

   Turbo.move(960);
   delay(1000);
}

I'm actually going to contain all the turbo so that it's all behind the scenes.. so you can get the actual position, commanded position, commanded speed, and temperature all from that library, which will clean up my main code in a big way and make it more readable (I think).. far less scrolling![/code]
'94 dodge, Colt Cam, head worked, NV5600, 3.55's, SB clutch, Ford manual hubs w. hawk brakes, custom flatdeck, custom aluminum bumper, cab off restoration, totally new engine, Mahle pistons @19:1..HE351VE with 67mm turbine and 67x95mm compressor
440hp/1000 ft lb @ 2400 RPM

*

Offline 65fpvmustang

  • Sr. Member
  • ****
  • 211
    • 65 mustang 83 ranger
Re: I fought the Max31856 and I WON
« Reply #2 on: April 25, 2016, 04:38:08 PM »
well if you fought the max 31856 i'm screwed. lol

*

Offline Rx7man

  • Crazy guy
  • Hero Member
  • *****
  • 908
  • Jack of all trades
    • '94 Dodge dually
Re: I fought the Max31856 and I WON
« Reply #3 on: April 25, 2016, 09:23:50 PM »
why that?
'94 dodge, Colt Cam, head worked, NV5600, 3.55's, SB clutch, Ford manual hubs w. hawk brakes, custom flatdeck, custom aluminum bumper, cab off restoration, totally new engine, Mahle pistons @19:1..HE351VE with 67mm turbine and 67x95mm compressor
440hp/1000 ft lb @ 2400 RPM

*

Offline 65fpvmustang

  • Sr. Member
  • ****
  • 211
    • 65 mustang 83 ranger
Re: I fought the Max31856 and I WON
« Reply #4 on: April 27, 2016, 08:20:58 AM »
plan is to can bus to ms3, and me being a newbie figure this will be a challenge.

*

Offline Rx7man

  • Crazy guy
  • Hero Member
  • *****
  • 908
  • Jack of all trades
    • '94 Dodge dually
Re: I fought the Max31856 and I WON
« Reply #5 on: April 27, 2016, 09:24:25 PM »
I don't know much about MS, but I'll give a hand if I CAN
'94 dodge, Colt Cam, head worked, NV5600, 3.55's, SB clutch, Ford manual hubs w. hawk brakes, custom flatdeck, custom aluminum bumper, cab off restoration, totally new engine, Mahle pistons @19:1..HE351VE with 67mm turbine and 67x95mm compressor
440hp/1000 ft lb @ 2400 RPM