For discussion of Speeduino compatible boards designed / built by other members of the forum and for guidance around making such a board
By Wilz
#53530
Thank you pazi88 and everyone on the speeduino community for you hard work!

Finally got my own setup running after sourcing all the parts.
Because I have deleted the viscous cooling fan, I depend on the electric fan. If I understood correctly there is not enough timers on ATmega2560 to run PWM fans, so I added clone of Arduino Nano with simple code to the board, cut the fan control trace and built simple circut using 2N3904 to output 12V PWM signal for cooling fan when speeduino enables it.
Probably could also use the on board bluepill for this, but as I lack programming experience I decided not to repair anything that is not broken. I am planning to add A/C compressor control, because I would like to keep that function on my car.
Image
Code: Select all
//this code is meant to control bmw pwm fan
//set pwmPw constant between 21% and 94%

#define fanInputPin 7 // defining fan input from speeduino
#define fanOutputPin 3 // defining fan pwm output to fan control module
#define led 13 // defining led pin

const int pwmPw = 50; // pwm pulse width as percent

int fanInput = HIGH; // variable for fan input status
int pwmDelay = 0; // variable used for creating pwm

void setup() {
  pwmDelay = pwmPw*100; // conversion from percent to delay microseconds
  pinMode(fanInputPin, INPUT_PULLUP);  // setting mode for fan control input pin with internal pullup
  pinMode(fanOutputPin, OUTPUT);  // setting mode for fan control output pin
  pinMode(led, OUTPUT); // setting mode for led pin
}

void loop() {
  fanInput = digitalRead(fanInputPin); //read fan input pin
  
  if (fanInput == LOW) { // if input pin is set low, start pwm signal
    digitalWrite(led, HIGH); // set led on
    digitalWrite(fanOutputPin, HIGH);  // create 100hz pwm, set output high
    delayMicroseconds(pwmDelay); // wait for set delay
    digitalWrite(fanOutputPin, LOW); // set output low
    delayMicroseconds(10000-pwmDelay); // wait for 10ms minus set delay
  }
  else {
    digitalWrite(led, LOW); // keep led off
    digitalWrite(fanOutputPin, LOW); // keep output low
  }
}
User avatar
By pazi88
#53533
Yeah you could have easily done that with the bluepill :D I'm currently working on next board revision that will have bluepill controlling the pwm fan. And also A/C control by bluepill. The A/C commands come through CAN bus, so the control is easily built into bluepill. Next revision will also have the original K-line that was used for diagnostics etc. on stock ecu. I already have it working on my prototype:
Image
User avatar
By pazi88
#56020
Version 1.5 available in GitHub: https://github.com/pazi88/Speeduino-M5x ... 0m54%20PnP
Image

Well ok, there is 1.5b too. This is just to be able to use LIN-transceiver for the K-line because native ISO-9141 transceivers are unavailable in this chip shortage.

This version has few HW additions:
- K-line interface to be able to log ecu with same tools as stock ms42/43 ecu.
- PWM Fan control using the bluepill (not yet implemented in code)
- A/C control using the bluepill (not yet implemented in code)
- Possibility to read cruise buttons and use those as speeduino inputs (99% implemented in code)

Here's a demo of reading those cruise button presses (The VSS1 is showing the code that is being sent from the button interface):
Image

And yeah, the bluepill code now supports reading individual wheel speeds from vehicle CAN bus to speeduino:
Image

This is also available for older board versions too. If you are updating code for older than 1.5 board versions, uncomment the
Code: Select all
#define REV1_5 
-line from the code. I'll shortly add precompiled binaries to the GitHub too, so you don't need to bother with compiling those. Just use STM32 CubeProgrammer to update the bluepill.
By ThornyPotato
#61399
Is there any way to get the firmware for the bluepill? I swapped the m52tu into an e36 and want vss/fuel level to the speeduino. or are there any other options? the e36 has a wheel speed sensor from the rear going to the ecu, along with a vss from the diff. I could wire either into the pnp board's vss input, right? I just need to change the code to reflect the different tooth count.
By dazq
#61428
ThornyPotato wrote: Fri Feb 24, 2023 4:55 am Is there any way to get the firmware for the bluepill? I swapped the m52tu into an e36 and want vss/fuel level to the speeduino. or are there any other options? the e36 has a wheel speed sensor from the rear going to the ecu, along with a vss from the diff. I could wire either into the pnp board's vss input, right? I just need to change the code to reflect the different tooth count.
His bluepill firmware is on this boards GitHub too
By ThornyPotato
#61454
dazq wrote: His bluepill firmware is on this boards GitHub too
The .bin file for the firmware is, but that's a compiled version. I was looking to see if there was a way to get the original sketch for the board so I could change the vss input speed unless there's another way to do that.
By dazq
#61470
ThornyPotato wrote: Sat Feb 25, 2023 3:08 pm
dazq wrote: His bluepill firmware is on this boards GitHub too
The .bin file for the firmware is, but that's a compiled version. I was looking to see if there was a way to get the original sketch for the board so I could change the vss input speed unless there's another way to do that.
Yes the files are there , serial3 to BMW can folder
User avatar
By pazi88
#61510
Yeah source code is in GitHub and you can reprogram it with FTDI interface. This is old board version, but you get the idea:
Image

Remember to compile the code with PIO. Otherwise it wont work. There is some compile parameters set in the platformio.ini

The VSS input is not yet coded in the PluePill FW. Just don't have enough time... But if you make it work, please make PR of it and I'll include it.

There is also PWM Fan and AC-support missing that I plan to include.

Had it running for a short period again. Same as […]

Ok, here is the first version of the adapter plate[…]

Ignition Angle doubled?

don't load your old tune in case it is corrupted[…]

Yes, totally wrong setting. Slight noise in TPS ca[…]

Still can't find what you're looking for?