Go Down

Topic: Dyno controller, searching for inputs? (Read 5162 times) previous topic - next topic

Palle B

Aug 26, 2010, 12:31 pm Last Edit: Aug 26, 2010, 06:55 pm by Palle_B Reason: 1

I am brand new to Arduino(just got it today :) ).
My first project is, building a Dyno-controller, for my engine brake, based on the Arduino Duemilanove.
And a big watercooled diskbrake, a torque arm with a weight cell/amplifier that produce a 0-5v output.
Unfortunatly i have no pictures yet.

My plan is to take it step by step, and hopefully learn along the way.

My first task is to get a stable rpm counter, via a halleffect sensor.
Then produce a open loop PWM output, to control a fast acting valve(that control the brake), so that i can keep the engine below a chosen rpm(target),
To determine the target value(0-15000), my plan is first to use a potmeter, just to get started.
But i plan to make a feature later, so i can rev the engine to any rpm, and press a "hold this rpm" button, then have a "+" and "-" button, to raise or lower the target rpm by 100, at each push on the button.(if any of you a great idea for that i will be more than glad to try it out now anyway ;-) )

And i will need an "auto-sweep" function, that starts at say 1000rpm, holds it there for 1sec(to stable the weight cell), then raise the target by 100rpm's, for each following sec.
Until the rpm drops below 1000rpm's again(or another value), to tell the auto-sweep is over.
Later i will have a software, that will log the values, of the weightcell(nm), and calculate the hp from that.
I was thinking to send the value, to the software, just before every raise of rpm.(as the weight cell is most steady, at that time)

I also plan to use a display, i was thinking 2x20 lines, that can tell me the target rpm, and realtime rpm on the first line, and NM and HP, on the second line, so that i can read the realtime values without any pc plugged in.

Even later than this i will try to make a weather station, to compensate for barometic pressure, humidity and temperature.

But my first task is to get to work, so i can get some readings out.
Not  to get the dynofigures, to brag with, at the gasstation, but for adjusting and mapping the engine.

That means that i will start with the revcounter.
I have been searching this forum and found some fine examples, but some of seems to be very accurate and complicated?
This one for example: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1274834441
Seems to contain alot more than what i need?

And this: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1281925297
This one looks like it could work for me to, but i was hoping to go open loop?

Palle B

I have been trying out alot of the different code examples, through the afternoon.
And had a number of led's blinking, trying to change the values a bit,  and written a graph to the pc, fun stuff :)
but how do string the codes together?

I mean how can i grab the value off a revcounter, to use as a value, in the analog write?(for starters)

When i come to think of it, it's not the value of the revcounter, it's the value of the difference between target rpm, and actual rpm i need to use?
That's not making it easier for me.

But if i can learn how to do the first, i might be lucky enough, to learn the rest.

I hope that one you programguru's can point me in the right direction?

Thanks in advance.



Why use a hall effect sensor at all.  Depending on the engine, and ignition system, you could
a) connect to the coil like a display tach, count the pulses and do the math (there is a sample interrupt driven counter on this forum, just search for tachometer)
b) most CDI boxes have a tach out signal, which is usually a 12v square wave, which you should be able to reduce to 5v with either a simple voltage divider, or a regulator (I'm trying a regulator for the Data Acquisition system i'm building using the Mega board (more inputs, and more memory)
c) use a magnetic switch, with a magnet on the flywheel, you then feed the switch cycle into the interrupt handler, count  and display RPM every X ms (I'm planning on using 250ms interval for display, but you could go more granular

Here is some code (taken frm the referenced post to the forum, and made into an object).  Note, I still have to adjust the "pulses per rotation" for my 6Cyl motor, but if you use a mag switch, then you have 1 pulse per rotation.

// Tachometer hooked up to interrupt 0  Digital Pin 2 on All boards.
unsigned long tachCount;  // Global scoped within the object.  

// Interupt function.  Can't be part of the object.
void tachPulse()

     tachCount = 0;
     _time = millis();

void Tachometer::tachprocess(unsigned long time)
     int rpm;
     unsigned long deltat;
if ( (millis()-_time >= 100) )
   // rpm = number of interrupts counted in 100ms
   //  *10 to make per second
   //  *60 to make per minute
   //  /2 for 2 pulses per rotation (4 cylinder)
   //  /10 for some reason???
   rpm = (((tachCount*10)*60)/2)/10;
   //Do things with the RPM value here (update display etc)...

   tachCount = 0;
   _time = millis();


void Tachometer::tachSetup(unsigned long time){
     _time = millis();
     tachCount = 0;


Why use a hall effect sensor at all.  Depending on the engine, and ignition system, you could...

One good reason would be to have a dyno setup that required no electrical connection to the car electronics. Run the car up until the car tach indicates something like 2000 rpm, then use that for a calibration point for the dyno program rpm monitoring.  
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

Palle B

Thanks for youre inputs.
The reason for usng a hallsensor is like Zoomcat says.
I will have all the wiring on the bench, so that i can test other engines with no electronics/rev counters.

And i have about 40 hallsensors lying in a box on the shelve, that was handed to me, as the previous owner never used them anymore.
I plan to use 1 pulse pr rev.

I have tried to upload the code you provided, just to test.
But it says "error tachometer has not been declared" ?
Now where/how can i declare it?

And again thanks alot for youre help.



Aug 27, 2010, 06:44 pm Last Edit: Aug 27, 2010, 06:46 pm by zoomkat Reason: 1
Somewhat off topic, but some dyno videos of Honda S2000s (I've got a rio yellow 2005) which show dynos in operation.

http://youtube.com/watch?v=1o5JaDIxh5w exhaust dyno
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

Palle B

Nice 8-)

I only viewed a couple the videos for now, and i saw that it is inertia dyno's(the ones i saw anyway)

The bench i'm building is a brake-dyno inspirated from this tread: http://forum.savarturbo.se/viewtopic.php?t=42360
Its in swedish, but google translate is you're friend ;)

I have been cracking my head lately, with how i get the value for the pwm output?
At first i tried to take the difference in % between target and actual rpm, to create a PWM value, but i don't think that's gonna work?
Because it should hold the engine "down" on the target, if the rev's rises above target, it should brake until the target is reached, and hold it there?

Anyone with a great idea here?


Looks like a Prony Brake setup. As to determining the rpm, you might search for a tachometer or rotary encoder code for detecting a rotation event and some timing code to determine the rpm.

Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

Palle B

Yes. it is a kind of prony brake.

For calculating rpm, i have been trying ALOT of codes out, found on different places, most of them seem to work just fine.
I haven't decided yet, which codevariant it's gonna be.
But im pretty sure, that this isent my biggest problem, i'm really thinking hard about, how to determine the open loop pulsewidt, to control the brake?

I have been looking for some motor controller codes, but i don't think i have found any, that i can use?
That can very well be, because i don't understand the codewriting, good enough yet, to see them through.


You might look at servo controls and setups. A servo is given a target position to maintain, and adjust itself based on feedback to maintain the target position. In the arduino, you need to determine a current rpm value from some type of input, and compare it to a desired value probably input from a pc running the dyno application. Based on a +- numeric value deviation from the desired value, a direction (and magnitude) value generated to control a servo or motor controller which will control the brake. Probably need to determine the mechanical method to control the brake (servo, linear actuator, etc), to determine the software that will be needed.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

Palle B

Aug 28, 2010, 08:39 am Last Edit: Aug 28, 2010, 08:40 am by Palle_B Reason: 1
Again thank you for the pointer.

I have been looking alot at this one: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1281130816
But i dont think its open loop, and the pwm control part is, a bit over my head just yet.
I can feel that i'm catching on, a little at the time, but the math pieces, with khz, rpm and dutycycles is a bit confusing for me, for the time being.

Go Up