Home     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science

### Author Topic: Valve controller for auto turbos.  (Read 7483 times)

0 Members and 1 Guest are viewing this topic.

#### Stian1979

• Guest
##### Valve controller for auto turbos.
« on: September 20, 2010, 10:19:18 AM »
Downloaded Mplab a few days ago and was hoping to make some code for a simple circuit to controll turbos.
I was thinking to go for a twin turbo setup and wanted to route all the exhaust into one of the turbos during low load and rpm.

I was therefore interested in making a simple circuit that would multeply RPM with boost in the manifoil so that once one turbo can not flow enough the second is engaged.

For this I would need:
1 one input for mA or V for boost from a transmitter or read it from the ECU trough canbus.
2 one input reading RPM by pulses, voltage or canbus from ECU.
3 two outputs where one open the valve out to the turbine and the second open the valve to the compressor once it's given time to spoole up.

I have done some reading on the mplab, but I'm not sure how I could do this exsact task.

#### kam

• Hero Member
• Posts: 1849
##### Re: Valve controller for auto turbos.
« Reply #1 on: September 20, 2010, 17:14:06 PM »
I love it! I really do! What car are you boosting?

So, regarding case 1, the mA or V input. You can use the built-in A/D converter of any PIC that supports this function.

For case 2, the TMR1 input is just fine. This is a 16-bit timer, perfect for RPM reading. I have test it myself. You will read pulses. I do not suggest to have 2 A/D simultaneously (supposing that you use the A/D for case 1)

For case 3,  any digital I/O pin is suitable, as long as you buffer the valve with a power transistor or mosfet.

Let me tell you what. I love raw power on 2 or 4 wheels. And i like this project. If you are willing to host this project in pcbheaven (pcbheaven projects). I will make the programming for you completely, and leave some parameters for you to play with (response time etc etc etc). You will only send photos of the project worklog and videos. What do you think? (the credits will go to you of course  )

#### Stian1979

• Guest
##### Re: Valve controller for auto turbos.
« Reply #2 on: September 21, 2010, 05:26:05 AM »
To be honest I'm not looking into having someone else do it for me.
I see this as a opertunety to learn to do this myself, but I would need some pointers on how to get going.
mplab seams quite different from PLC's that I'm used to, but I see alot of posebilty if I take the trouble to learn it.

#### kam

• Hero Member
• Posts: 1849
##### Re: Valve controller for auto turbos.
« Reply #3 on: September 21, 2010, 20:33:34 PM »
i totally understand you. Check this on-line PIC book...

#### Stian1979

• Guest
##### Re: Valve controller for auto turbos.
« Reply #4 on: September 22, 2010, 05:22:48 AM »
i totally understand you. Check this on-line PIC book...

I was reading quickly trough it a few days ago, but it's quite clear to me that I have lost something essensial.
I can not figure out how to do this.
I gues I need to go trough it again and read the details.

#### kam

• Hero Member
• Posts: 1849
##### Re: Valve controller for auto turbos.
« Reply #5 on: September 22, 2010, 19:06:03 PM »
Getting familiar with the MPLAB environment

And then play with some tutorials, starting page 22. Is essential to read ALSO page 22.

#### Stian1979

• Guest
##### Re: Valve controller for auto turbos.
« Reply #6 on: September 24, 2010, 09:18:45 AM »
Even I got some general knowledge about PLC's it seams I have trouble getting into this PIC stuff.
I might struggle with the language (I'm not English or American) but also I only have practical experience with this stuff and limited theoretical background. Is there somewhere I could read up a little?

I have a heavy theoretical background in thermodynamics so I know turbos, gas turbines and engines should be controlled, but putting that into electronics is something I need to learn.

I been thinking to find a PIC that use canbus so I don't need additional sensors for boost.

#### kam

• Hero Member
• Posts: 1849
##### Re: Valve controller for auto turbos.
« Reply #7 on: September 24, 2010, 21:12:10 PM »
Before you start your project, i suggest you learn first the baby steps... crawl around. Get a 16F88 (pretty powerful) and download the datasheet from microchip. Then, start with simply tutorials like turning on and off an LED, blinking the LED, interface a button and staff like that. I have some tutorials for the 16f88 in my on-line book (i gave you the link before). You will need a few days of experiments to get to the point. Do not wait only from reading to understand. Get a breadboard, resistors, capacitors, LEDs and switches, and play.

#### Stian1979

• Guest
##### Re: Valve controller for auto turbos.
« Reply #8 on: September 25, 2010, 12:17:47 PM »
I been working with connecting functions to register addresses, but understanding work register, file register and all this I struggle with.
I need to get my my head around this stuff.
Going to go and get myself a PIC once I get home and play with.

#### kam

• Hero Member
• Posts: 1849
##### Re: Valve controller for auto turbos.
« Reply #9 on: September 25, 2010, 16:54:03 PM »
totally worths the effort

#### Stian1979

• Guest
##### Re: Valve controller for auto turbos.
« Reply #10 on: October 04, 2010, 18:17:40 PM »
Spent the last week reading up and I think I'm ready to start programing.
My wife is in hospital and I just started a store selling biker gear so I don't have much time.
Going to try to start to write the program this week and run a few simulations and see how it go.

I have one question and that is how to set and clear ports.
If I set a port by using 00010 how can I clear only that  port?. I have only found info how to clear all of them.

Also how can I scale a digital signal and how do I use signals trough canbus?

#### kam

• Hero Member
• Posts: 1849
##### Re: Valve controller for auto turbos.
« Reply #11 on: October 06, 2010, 07:13:44 AM »
suppose that you set the portA 1:

movlw '00010'
movwf PORTA

You can set ONLY this port (PORTA 1) also:

bsf PORTA,1

and clear it

bcf PORTA,1

What do you mean "scale a digital signal"? Change the amplitude?

as for the can bus, i am not sure i can answer this question.

#### Stian1979

• Guest
##### Re: Valve controller for auto turbos.
« Reply #12 on: October 06, 2010, 07:28:03 AM »

What do you mean "scale a digital signal"? Change the amplitude?

as for the can bus, i am not sure i can answer this question.

I work much with automation systems where we use canbus or modbus communication.
We normally import a tag trough the bus communication witch will be 0-1024bit so we need to scale it to the signal it represent.
If 0 is -10 Celsius and 1024 is 50 Celsius we need to scale the bit value from -10 to 50.
If I where to import RPM and boost trough the canbus link on the ECU I would like to scale like this.

If not I guess I just have to go trough it in a mathematical way. "bit value / 512 x bit value / 0,14= tiger output if higher than??"

#### kam

• Hero Member
• Posts: 1849
##### Re: Valve controller for auto turbos.
« Reply #13 on: October 06, 2010, 17:01:09 PM »
Oh i got it. You will go with maths. Yet, you should have in mind that you are holding an 8-bits PIC. Maths will be a little bit more complicated, as you only have add and sub functions. I strongly suggest you visit the section that i have with code snippets, in which you will find functions for division and multiplication. The URL is:

Do not try to do this alone. Also, try not to use decimal numbers. For example:

value / 512 x value / 0,14

I would convert it to

value / 51200 x value / 14

and of course i would have multiply the value by 100. Also, prefer to multiply or divide by powers of 2. For example, instead of multiplying all nymbers by 10, you can multiply them by 64. The number 0.14 will be 8.96, which is actually very close to 9. The error in calculations would be as if you had divided instead of 0.14 with 0.140625, which is very small.

I tell you this, because the multiplication with powers of 2 can be achieved easily, simply by shifting the bits of a register left (to multiply) or right (to divide).