DIY Drive by Wire controller project.

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

Moderators: jsmcortina, muythaibxr

piubrazil
Helpful MS/Extra'er
Posts: 83
Joined: Sat Feb 28, 2009 6:16 pm
Location: Sao Paulo - Brazil

DIY Drive by Wire controller project.

Post by piubrazil »

This project has nothing to do with B&G or the developers team of original Megasquirt products. It is an experimental project to control electronic throttle bodies found on newer cars and are not intended to be used in countries that have strict laws about modifying cars or their electronic safety devices. This project is under development and who decide to experiment it, be warned of all the risks involved.


Some customers cars who wanted to use Megasquirt are "new" and uses DBW throttles. Sometimes is easy to convert the engine to old mechanical throttles, but not all cars have the facilities to do this job.
I started to develop my own DBW controller and after long time testing I finally finished it in a small board with transparent integration with megasquirt, using PWM output to control the idle, and have a provision to Idle Up for A/C control.

The circuit is PIC based and uses a TL494 and a L6203 H-bridge to work in a closed loop. Long story short, the PIC read all the analog voltages from TPS, PPS, PWM, do the correlations between all them and create an analog output that is feed into TL494, generating a 16Khz PWM and driving the H-bridge L6203, feeding the motor at DBW body and making it track the real position of the throttle pedal. The feeling at pedal is exactly as if the throttle is cable linked to your foot.

The main concern about DBW aways where the security and reliability of the system. The PIC do the checking of redundant signals from pedal position sensor and DBW body, checking if the values are in the correct correlation between them, and in the case of a reading a wrong os suspect value, the Pic disables the H bridge, getting the plate at mechanical "resting" position, wich normally is at little open than idle.
In the case of failure of H-bridge, like one or 2 transistors shorted, there is a polyfuse dimensioned to work at normal condition, and trips if the current of the motor rises above the normal operating value.

This circuit is being used for 2 years before I decided to share with the community with zero fails ocurrencies, but obviously, this is shared "as is" and should be used at own risk. I'll take no responsabilities for anyone implementation os this design, so be awarned!

I chosed the PIC18F2620 due to number of A/D inputs, even it looking too overdimensioned to application. At this time I'll releasing just the HEX file , once the code is made in assembly and all the comments are in portuguese, not helping too much if anyone wants to improve the code. I'll translate the comments to english if the community becomes interested.

The schematic and PCB where made in Protel, and are in the zip file.

This controller is in my line of products offered to my customers and the intent of sharing this project is to help who wants to make your own DBW controller, and should not be used in commercial way.

Feel free to comment and add ideas on the project.
Last edited by piubrazil on Tue Dec 24, 2013 2:32 pm, edited 2 times in total.
Luiz Henrique - Piu
São Paulo
Brazil
piubrazil
Helpful MS/Extra'er
Posts: 83
Joined: Sat Feb 28, 2009 6:16 pm
Location: Sao Paulo - Brazil

Re: Megathrottle - Drive by wire for Megasquirt

Post by piubrazil »

The zip files containing the protel and HEX files.
DIY_DBW controller V1.00.zip
Pictures of the assembled board:
Last edited by piubrazil on Tue Dec 24, 2013 2:35 pm, edited 1 time in total.
Luiz Henrique - Piu
São Paulo
Brazil
atomic6
Experienced MS/Extra'er
Posts: 317
Joined: Sat Nov 13, 2004 11:29 pm
Location: omaha

Re: Megathrottle - Drive by wire for Megasquirt

Post by atomic6 »

Could two of these be used off of one pedal, for dual DBW throttle control like the Holley Dominator ECU?

Also, is there a way to buy one of these(or a kit version) from you, or would be have to build our own from scratch?

Thanks for sharing with us, this achievement.
1986 G.N. (sold)
1967 Nova II wagon (sold)
ex-MSer
jsmcortina
Site Admin
Posts: 39585
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Megathrottle - Drive by wire for Megasquirt

Post by jsmcortina »

Looks interesting, what provisions are in place for software and hardware failsafes?

I've alluded to these in a few other topics.
http://www.msextra.com/forums/viewtopic ... 6&p=383063
http://www.msextra.com/forums/viewtopic ... 1&p=383846

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
piubrazil
Helpful MS/Extra'er
Posts: 83
Joined: Sat Feb 28, 2009 6:16 pm
Location: Sao Paulo - Brazil

Re: Megathrottle - Drive by wire for Megasquirt

Post by piubrazil »

When I started to develop this project , I tried to implement a DBW controller that did not depend entirely of a microprocessor that could easily lock in an electrically hostile environment such as an automobile .
I have personally seen many cases where the injection module suffer constant resets due to spark plug wires with poor contact , poor insulation and leaking sparks , so I decided that the control should not have a very close interaction with the ECU.

My only programming experience is with Pic Assembly , then the obvious choice fell on this family of microcontrollers . Although the PIC is very robust for noise, I was unable to get an acceptable way to control a servomotor in closed loop, fast enough to get a soft and strong movement of the butterfly. Due to my weakness in programming another platform, I choosed to control the servomotor analogically, as this mode of control has been proved very reliable in industrial controls.

Thus, the PIC would only read the various voltages of the sensors to validate the correlation between them and create voltage stops, to avoid the butterfly fully opens or closes.

The PIC also controls the Enable input of the H-bridge and if any abnormality is observed in sensor values ​​, it disables this bridge and Butterfly falls in the rest position .

The PIC program verifies some obvious points that indicate failure of densores :

1 : If the PPS signal voltage is between 0.2V and 4.8 V. Any voltage above or below these values ​​indicate broken wiring, PPS fault , short circuit with 5V or ground and immediately disables H. Bridge

2 : The same check is done for the PPS-Half signal. Beyond, checks if this voltage is half of the main signal, with a maximum variation of 10 % indicating normal wear of the resistive track. Any variation of this voltage, or if it is larger than 10 % variation from the nominal value, the PIC disables H-Bridge

3 : The same reading is taken in the main TPS , if the voltage is between 0.2 V and 4.8 V. Any reading outside this range disables the H- bridge

4 : In the inverted TPS , the check is the same , but as it has exactly the reverse curve main of TPS, the code do a logical inversion and compare the two voltages, both have to own up to 10 % variation between them. If the variance is greater, will disable the H-bridge.

5 : Working with the DBW body, I noticed that the average current work ranges from 0.2 A (when the throttle is close to its rest position) to about 800mA (when the plate is at maximum opening, forcing the return spring, but without mechanical locking).
However, if for some reason the H bridge lock fully open or fully closed, the motor current reaches 3 amps, so a way to protect this occurrence would be to measure the load on the motor and if it passes 1A for a few seconds, should have their power cut. The simplest and most reliable way I found to do this was to use a POLYFUSE, not to depend on software and watchdogs that are not infallible . A POLYFUSE 1A trips in 3 seconds when triggered by a current of 3A , as I found when the plate "locks" fully open or fully closed.

6 : The entire program of the PIC only has one call to the internal watchdog reset . Then, the program must have to do all the calculations and reset the watchdog every cycle of the loop . Making the watchdog reset in only one place in the code helps increase system reliability.

7 : Making analog servo control , ensures that even if the PIC hangs, the PWM output is normally gos to 0 or 100 %, which would inevitably open or fully close the butterfly, ignoring the analogue voltage stops and causing the POLYFUSE acting , cutting the power to the bridge H.

In 2 years of use, I got 1 PPS and 1 DBW-body failure in different cars, and both starting to "loose pedal" ramdomly, and these looses getting more and more frequent, until it happens at about 3 times a day. Replacing the deffective parts solved the problems. In another car, due to poor location of the module I had to put a small heatsink in the H-bridge, because the repetitive tripping of the polyfuse.


What other important points you think would to be helpful if added beyond those I listed ?

If anyone has more ideas about implementing security in the project , we will discuss them and improve the project .
Luiz Henrique - Piu
São Paulo
Brazil
piubrazil
Helpful MS/Extra'er
Posts: 83
Joined: Sat Feb 28, 2009 6:16 pm
Location: Sao Paulo - Brazil

Re: Megathrottle - Drive by wire for Megasquirt

Post by piubrazil »

atomic6 wrote:Could two of these be used off of one pedal, for dual DBW throttle control like the Holley Dominator ECU?

Also, is there a way to buy one of these(or a kit version) from you, or would be have to build our own from scratch?

Thanks for sharing with us, this achievement.
Is possible to control 2 DBW throttles from just one pedal, if you share the PPS and PPS-Half signal connections between 2 controllers.
I have no plans to offer this board assembled or in kit form outside of Brazil :( . You must assemble your own board.
Luiz Henrique - Piu
São Paulo
Brazil
slyrye
Experienced MS/Extra'er
Posts: 255
Joined: Sun Aug 12, 2007 2:41 pm
Location: Philippines
Contact:

Re: DIY Drive by Wire controller project.

Post by slyrye »

Genius....!what is the settings for idle PWM output from megasquirt? how's it behaving on closed-loop idle control? :yeah!: :yeah!: :yeah!: :yeah!: :yeah!:
MSnS'n'4G15
piubrazil
Helpful MS/Extra'er
Posts: 83
Joined: Sat Feb 28, 2009 6:16 pm
Location: Sao Paulo - Brazil

Re: DIY Drive by Wire controller project.

Post by piubrazil »

Leave the PWM frequency at 100Hz or close. Set the Idle control in megasquirt as if you're using PWM idle valve. After the initial pot calibrations for min and max. travel of the plate (with PWM input disconnected) reconnect the input PWM and play with % limits of PWM settings to find out the correct parameters to your engine. From 0 to 100% of PWM, the plate will move about 5% of total travel. It's enough to rise the Idle to about 2500-3000RPM in majority of engines.
Luiz Henrique - Piu
São Paulo
Brazil
Mario
Master MS/Extra'er
Posts: 409
Joined: Sun Jan 30, 2005 11:13 pm
Location: Monroe, Wa.
Contact:

Re: DIY Drive by Wire controller project.

Post by Mario »

This is really cool. Do you have part numbers for the pedal and throttle body you have used?

I like how you have very neatly incorporated features into your project, and that it is transparent to the MS is excellent.
1967 Beetle My test mule
The Dub Shop
Facebook
Megasquirt for life!
shconer
MS/Extra Newbie
Posts: 26
Joined: Fri Aug 26, 2011 9:08 pm
Location: Calgary, Alberta, Canada

Re: DIY Drive by Wire controller project.

Post by shconer »

Would it be possible to get a BOM?
rcr1978
Helpful MS/Extra'er
Posts: 44
Joined: Tue Mar 23, 2010 7:08 am

Re: DIY Drive by Wire controller project.

Post by rcr1978 »

What type of software did you use, I tried a couple different types of Pads viewer's with no luck.

Thanks
Robert
piubrazil
Helpful MS/Extra'er
Posts: 83
Joined: Sat Feb 28, 2009 6:16 pm
Location: Sao Paulo - Brazil

Re: DIY Drive by Wire controller project.

Post by piubrazil »

Mario wrote:This is really cool. Do you have part numbers for the pedal and throttle body you have used?

I like how you have very neatly incorporated features into your project, and that it is transparent to the MS is excellent.
Will find it and post tomorrow.
Luiz Henrique - Piu
São Paulo
Brazil
piubrazil
Helpful MS/Extra'er
Posts: 83
Joined: Sat Feb 28, 2009 6:16 pm
Location: Sao Paulo - Brazil

Re: DIY Drive by Wire controller project.

Post by piubrazil »

rcr1978 wrote:What type of software did you use, I tried a couple different types of Pads viewer's with no luck.

Thanks
Robert
shconer wrote:Would it be possible to get a BOM?
This board was drawn with old Protel 98. Protel only runs in Win XP and is not hard to get and install it. I think Altium package can open and edit/print/BOM generate. I'm very used to draw my boards using this software and my PCB maker handles easily this format of file.
Luiz Henrique - Piu
São Paulo
Brazil
pixel.nine
MS/Extra Newbie
Posts: 3
Joined: Wed Jun 05, 2013 1:58 am

Re: DIY Drive by Wire controller project.

Post by pixel.nine »

Fala Piu, tudo bem?
Cara, eu montei uma MS2 e pretendo utilizar seu sistema de drive by wire em meu carro, para diminuir a quantidade de coisas passando pelo cofre. Uma pergunta que me surgiu e que eu acho que seria interessante até para você agregar ao seu produto.
Será que não seria possível a sua controladora ler o valor do VSS (Sensor de velocidade) e utilizar uma porta do PIC para receber o sinal de ON/OFF de um push button (Para ativar e desativar) e o sinal do pedal do freio para desativar o cruise control?
Quando ativado a sua controladora tenta manter o valor do VSS estavel abrindo e fechando a borboleta eletrônica.

Hey Piu, are you fine?
I build a MS2 using a V3 board and i will make your drive by wire board to use in my car to have less iron cables in the trunk. One question that i have and can be very intersting to you aggregate in you product.
Can be possible to your controller to read the VSS and using one port from PIC to receive the signal from a ON/OFF push button (To activate and desactivate) and the sinal from brake to desactivate the cruise control?
When activated, your controller will try to mantain the value of VSS stable opening and closing the throttle body.
piubrazil
Helpful MS/Extra'er
Posts: 83
Joined: Sat Feb 28, 2009 6:16 pm
Location: Sao Paulo - Brazil

Re: DIY Drive by Wire controller project.

Post by piubrazil »

Tecnicamente falando sempre é possivel adicionar funções em um projeto e, nesse caso, o pic trabalha muito folgadamente, quase não fazendo esforço. Adicionar o piloto automático no projeto não seria algo muito complexo do ponto de vista técnico.
Seriam necessário pelo menos mais 6 entradas digitais:

- botão de liga-desliga do piloto automatico
- botão up-speed
- botão down-speed
- botão no pedal de embreagem
- entrada do brake-light
- entrada sensor de velocidade

Contudo tenho um certo receio em deixar o controle do acelerador sob total controle do PIC, sem seguir um dispositivo mecânico como o pedal do acelerador. Tenho recebido algumas críticas a respeito do fator segurança do projeto como está e com certeza um piloto automático experimental seria alvo de apedrejamento, kkkkkkkk! Talvez numa versão 2.0.

Technically speaking, is aways possible to add up more functions into a design and in this particular case, the PIC load is very light, almost none processing power. Add a cruise control in design would not be a complex task from technical point of view.
Would require at least 6 more digital inputs:

- turn on-off cruise control
- up-speed button
- down-speed button
- clutch pedal switch
- brake light input
- vss input

Unfortunattely I'm afraid leaving the throttle control at PIC's full responsability, without control from a mechanical device like a acc. pedal. I've received some critics about safety factor of this design as it is currently shown, and an experimental cruise control added into, would be enough to start a stoning, kkkkkkk. May be a 2.0 version!
Luiz Henrique - Piu
São Paulo
Brazil
pixel.nine
MS/Extra Newbie
Posts: 3
Joined: Wed Jun 05, 2013 1:58 am

Re: DIY Drive by Wire controller project.

Post by pixel.nine »

piubrazil wrote:Tecnicamente falando sempre é possivel adicionar funções em um projeto e, nesse caso, o pic trabalha muito folgadamente, quase não fazendo esforço. Adicionar o piloto automático no projeto não seria algo muito complexo do ponto de vista técnico.
Seriam necessário pelo menos mais 6 entradas digitais:

- botão de liga-desliga do piloto automatico
- botão up-speed
- botão down-speed
- botão no pedal de embreagem
- entrada do brake-light
- entrada sensor de velocidade

Contudo tenho um certo receio em deixar o controle do acelerador sob total controle do PIC, sem seguir um dispositivo mecânico como o pedal do acelerador. Tenho recebido algumas críticas a respeito do fator segurança do projeto como está e com certeza um piloto automático experimental seria alvo de apedrejamento, kkkkkkkk! Talvez numa versão 2.0.
Muito legal ler isso, então a possibilidade existe o que é um primeiro passo! Do ponto de vista da segurança, você poderia abrir quais foram as críticas do atual design do projeto? As vezes para um usuário leigo, uma possibilidade soa como um problema gigantesco. Eu sou um entusiasta de performance e eletrônica, então gostaria de tentar entender o que os usuários "comuns" tiveram como impecilhos. De qualquer forma, seu projeto pra mim está MUITO legal, simples e eficaz e eu vou utilizar de forma que traga benefícios ao meu carro e ao acerto do conjunto.

Ao meu ver, a única coisa que vou alterar na montagem do esquemático vai ser utilizar um heatsink pra evitar qualquer problema de super aquecimento. De resto está ótimo.

It's very nice to read this, the possibilty exists this is a first step! From the point of view of the security, you can open to us what is the critics of the actual design of the project? To a "common" user, a possiblity of a problem can sound a catastrophic problem. I'm a performance and electronic enthusiast, and i like to understand what problem the "common" user has passed. Anyway, your project is VERY nice, simple and effective and i will go use to take benefits to my car and the tuning.

I will modify ONE only thing in the schematic, i will utilize a heatsink to protect the system from excess heating.
shconer
MS/Extra Newbie
Posts: 26
Joined: Fri Aug 26, 2011 9:08 pm
Location: Calgary, Alberta, Canada

Re: DIY Drive by Wire controller project.

Post by shconer »

I am trying to build this board, did you use ceramic capacitors?

Image
transaxel
Helpful MS/Extra'er
Posts: 74
Joined: Tue Apr 22, 2008 10:41 am
Location: Austria

Re: DIY Drive by Wire controller project.

Post by transaxel »

One Thing,

i´ve build the Controller board but had Troubles to get the PIC Chip working. The *.hex file didn´t include the configuration bits, and without the correct settings it isn´t working.
I have flashed with PICPgm Programmer Software which also says that the Fuse Bit´s are missing.
Would be nice if you could post the Settings to Programm the chip in the right way.

It can also be possible that i made a mistake, but the burn-programm always finished successfully. Only the Chip itself isn´t working, because when the DIAG Jumper is set the Driver should be activated in any case (or am i wrong?)

Gerald
Alfa Romeo 164 2.0 V6 Turbo running on MS2 Extra
transaxel
Helpful MS/Extra'er
Posts: 74
Joined: Tue Apr 22, 2008 10:41 am
Location: Austria

Re: DIY Drive by Wire controller project.

Post by transaxel »

piubrazil wrote:I chosed the PIC18F2620 due to number of A/D inputs, even it looking too overdimensioned to application. At this time I'll releasing just the HEX file , once the code is made in assembly and all the comments are in portuguese, not helping too much if anyone wants to improve the code. I'll translate the comments to english if the community becomes interested.
Any chance to get the C-Code? Would make troubleshooting much easier.... :RTFM:
Alfa Romeo 164 2.0 V6 Turbo running on MS2 Extra
piubrazil
Helpful MS/Extra'er
Posts: 83
Joined: Sat Feb 28, 2009 6:16 pm
Location: Sao Paulo - Brazil

Re: DIY Drive by Wire controller project.

Post by piubrazil »

Unfortunatelly, the source was made in pure assembly, and all the comments are in portuguese.

I don't know why the HEX didn't work for you. I use original PicStart plus from Microchip and good old MPlab 4.0 to write my PIC programs.

The configuration header of the source for pic:

processor 18F2620
#include "p18f2620.inc"
CONFIG OSC=HS, FCMEN=OFF, PWRT=ON, BOREN=ON, XINST=OFF, CCP2MX=PORTC, WDT=ON, WDTPS=8192, MCLRE=ON, PBADEN=OFF, LVP=OFF
__idlocs H'200000'
radix dec
Luiz Henrique - Piu
São Paulo
Brazil
Post Reply