Diesel Bombers

Diesel Bombers (https://www.dieselbombers.com/)
-   Audio Equipment/Electrical (https://www.dieselbombers.com/audio-equipment-electrical/)
-   -   Arduino Module Programming? (https://www.dieselbombers.com/audio-equipment-electrical/92996-arduino-module-programming.html)

2004LB7 03-15-2012 12:57 AM

Arduino Module Programming?
 
any one have experience programming an Arduino Module? i have an Arduino Uno

i am putting together a "Tap" shift setup on my 04 duramax. i have a good grasp of electronics and what it would take to get it to work but have never really done any programming. i think it is based on C++ but could be wrong.

i am hopping someone would be willing to help me through this. i drew up a flow chart that shows the process that i would like to program in to the Arduino module to be able to make the Tap shift work

if anyone is willing or interested let me know and i will provide any information i can

thanks
Jason

2004LB7 03-17-2012 04:24 PM

bump

2004LB7 03-20-2012 12:48 AM

i guess this is beyond all of us:igive:

megancheung 03-21-2012 10:14 PM

With upto 5m range, how can i bring my laptop and do a wireless programming for my already deployed Arduino based devices which is hard to open.

2004LB7 03-22-2012 01:29 AM

? what:s:

i understood that about 10 different way

AdrianD 04-15-2012 07:41 AM

Post up the diagram and I will try to help :)
If the shifting is anything like the Jeep's AW4 automatic, then it should be relatively simple and fun to do.

I'm actually prototyping on an Arduino-based VNT controller right now...

2004LB7 04-15-2012 11:24 AM

thanks, i will see what i can do

PSDGuy 04-17-2012 10:34 AM

Ya, post up the diagram.

Do you know what pins you will be using as input to the trans (which pins are pulled low/high to get it to shift)?

Do the tranny pins take a 5v or 12v signal?

If 5v, then you can just directly signal the trans from the arduino; if not, then you will need some sort of relay or transistor to switch the 12v signal with a 5v gate.

2004LB7 04-18-2012 12:28 AM

2 Attachment(s)
sorry for the delay, busy week/weekend

the TCM uses 12v so i would use relays to isolate it

here is a diagram. it is not 100% complete but it should be enough to get started

i plan on using the 1 wire that comes in for the horn with a voltage drop resister network (as a new clockspring is expensive). i have a steering wheel with the buttons that i will need to check the resistance on and determine what voltage drop we will be getting so it can be programmed in

to keep the horn functional i can have the Arduino board activate a relay dedicated to the horn, i will just need to wire a resistor to the current contacts in the steering wheel for the horn button

i will finish the circuit and upload it shortly

thanks for your help
Jason

2004LB7 04-18-2012 12:30 AM

PS zip file has full size file

PSDGuy 04-18-2012 06:46 PM

It appears if you use 50 ohm resistors you will have the following # of closed switches vs. input reference voltage values:
# closed switches ref volts
0 5V
1 2.5V
2 1.7V
3 1.25V
4 1V
5 0.83V

One problem with this design is that you won't know which switch is closed, only how many (for example, how will the controller know when the downshift switch is pressed vs. the upshift switch). If you had each switch wired individually, you could just use each on a seperate digital input pin (I believe you can use the analog pins as digital pins as well) and the program logic would be very easy.

2004LB7 04-18-2012 07:50 PM

i went through this conundrum too. the problem is i only have one wire coming though to the steering wheel (horn wire) otherwise i would need to buy a new expensive clockspring

the only way i could see doing it with the stock button steering wheel is to use the existing resistor network. i will need to setup a 5 volt power supply and check the voltages as i dont know the values of the resisters in the buttons, and it appears that there may be some diodes in there somewhere as my meter doesn't seem to read it right.

i believe the resistors are of different values so as to not confuse which button is being pressed, ie: if two buttons where to be pushed then the value does not add up to the value of another button.

the way it is set up is that the buttons are under a rocker mechanism so upshift and downshift cant be pressed at the same time.

i will take a photo of the buttons to see if that helps to explain it better

thanks Jason

---AutoMerged DoublePost---

another question: can this board except 12~14 (or higher with limiting resistors) volts as an input or only up to 5 volts?

asking because the solenoids monitored to determine which gear it is in are at the line voltage of the transmision

PSDGuy 04-18-2012 09:27 PM


the only way i could see doing it with the stock button steering wheel is to use the existing resistor network. i will need to setup a 5 volt power supply and check the voltages as i dont know the values of the resisters in the buttons, and it appears that there may be some diodes in there somewhere as my meter doesn't seem to read it right.

i believe the resistors are of different values so as to not confuse which button is being pressed, ie: if two buttons where to be pushed then the value does not add up to the value of another button.

the way it is set up is that the buttons are under a rocker mechanism so upshift and downshift cant be pressed at the same time.
Okay, this makes sense. Now you just need to get your 5V source set up and you can just probe the reference node while pressing the buttons to see the corresponding voltage values.


another question: can this board except 12~14 (or higher with limiting resistors) volts as an input or only up to 5 volts?
The arduino uno's recommended input is 7-12V, but I think it will take up to 20V.

2004LB7 04-18-2012 11:44 PM

1 Attachment(s)

The arduino uno's recommended input is 7-12V, but I think it will take up to 20V.
so it should be fine to tap into the solenoid power wires to monitor which ones are live right?

this is so if you turn on the tap shift function while driving it wont jump from say 4th gear to 1st when starting out. this can also be used for normal use too. say the transmission happens to not shift (sometimes happens when pushing HP/towing, etc) the programmed counter does not get out of sinc with the transmission

1st gear = pin #2 & 4 hot
2nd gear = Pin #2, 3 & 4 hot
3rd gear = Pin #3 & 4 hot
4th gear = Pin#3 hot
5th gear = Pin#2 & 3 hot

since the only way (other then the can bus) to switch between 4th and 5th gear is the overdrive lockout function. this would be a separate relay wired in parallel with the O/D LO button on the shift lever.

one pin wired to this relay and another wired to the O/D LO light to monitor when it is on or off - if it is off pulse relay to turn it on (disable 5th gear when in 4th or lower) when in 4th pulse it to turn the lockout function off to enable 5th gear

attached is an update to the drawing. i added the TCC control via a relay and mosfet. the relay is used to trick the TCM and the mosfet is used with PWM to ramp on the TCC - hope that is not too much to ask. if it doesn't get ramped on you have the potential if braking hard parts so ether leave this part out or make it ramp on (we can start slow, 2 seconds, and test it till it feels like smooth but quick by shortening the ramp time)

2004LB7 04-19-2012 12:35 AM

ok, so i found a power supply at 5.30 volts (will retest again with a 5.00V one later)

tested it with R1 being at 10K ohm and here are the readings:

upshift = 2.15 volts
downshift = 3.05 volts
TCC on/off = 1.25 volts
tapshift on/off = 1.60 volts

what would be easier to program? one button that when pushed would turn on and when pushed again would turn off

or one button for on and another button for off?

i have 6 buttons to work with if the latter is easier

for a 6 button setup

upshift = 2.15 volts
downshift = 3.05 volts
TCC on = 1.25 volts
TCC off = 1.60 volts
tapshift on = 0.60 volts
tapshift off = 0.75 volts

AdrianD 04-20-2012 02:50 AM

Brilliant idea to use resistors for having control on a single wire.
Basically you will use only one analog input on the module and 4 buttons are plenty.

Pulse 2 for 1 sec means keeping pin 2 on high for 1 second ?
What kind of PWM duty cycle do you need on pin 5 ?
What about turning manual mode on/off ? What output on what pin do you need for that ?

At this point I am not at home so I don't have access to my PC to actually test it but it should be close.

The Uno should work with up to 20v. I personally would use an LM317 to keep the voltage around 10v, just to be on the save side.

2004LB7 04-21-2012 12:18 AM


Brilliant idea to use resistors for having control on a single wire.
thanks. needed to come up with a way to use the one wire that i had coming into the steering wheel to operate multiple controls. not all my idea though. it has been used before through out electronics. when i was trying to learn about the input monitoring for the arduino board i came up with the idea for this


Basically you will use only one analog input on the module and 4 buttons are plenty
well i was hoping to use the 6 button (actually 7 as i need one for the horn) setup as it seems to be less error prone. say you push the button for locking the torque converter and push it again to unlock it, if for some reason you cant tell if its locking or it wont lock and you push it again trying to get it to lock well you would now be giving the command to unlock.

with one button for locking and another for unlocking then you can push the lock button several times and still know what you will be commanding it to do

same for the TAP control functions. one button to enable another to disable it.


Pulse 2 for 1 sec means keeping pin 2 on high for 1 second ?
yes. the overdrive lockout function needed to switch between 5th and 4th gear is activated by holding down the tow/haul button for approximately 1 or more second


What kind of PWM duty cycle do you need on pin 5 ?
this will have to be experimented with. i am thinking ramping from0% to 98% in about 1.5 seconds. the time is what we will need to play with


What about turning manual mode on/off ? What output on what pin do you need for that ?
one button for turning it on and one for turning it off. the output pin is 13 but any free pin used to activate relay #1 will work. relay #1 is used to transfer the wires going down to the NSBU switch (the column shifter for gears 1, 2, 3 & D activates the NSBU switch) to relay #3, 4 & 5 which is used to trick the transmission into thinking the column shifter is being changed


The Uno should work with up to 20v. I personally would use an LM317 to keep the voltage around 10v, just to be on the save side.
i will use a voltage regulator to provide a steady voltage to run the board. i was wondering what the max voltage the input sensing pins can handle. the solenoids that need to be monitored are run at the vehicle voltage. otherwise relays or maybe a string of diodes to drop the voltage down to a safe level for the input pins will be used

thanks Jason

2004LB7 04-21-2012 01:23 AM

1 Attachment(s)
lets see if i could type up a flow chart for this

1. push Tap-shift-on button. 5 volts reference drops to 0.60 volts
1a. arduino board checks pins: 2, 3 & 4 to determine which gear the transmission is currently in and make pin #6 go high

1st gear = pin #2 & 4 hot
2nd gear = Pin #2, 3 & 4 hot
3rd gear = Pin #3 & 4 hot
4th gear = Pin#3 hot
5th gear = Pin#2 & 3 hot

1b. the arduino board activates relays 3, 4 & 5 and pulses pin #8 as needed to match the current gear

1st gear - relays 3 & 5
2nd gear - relays 3 & 4
3rd gear - relays 3, 4 & 5 all off
4th gear - relays 4 & 5 and if overdrive lockout indicator light is off (pin #7 = high) pulse pin #8 to turn on O/D LO
5th gear - relays 4 & 5 and if overdrive lockout indicator light is on (pin #7 = high) pulse pin #8 to turn off O/D LO

1c. the arduino board turns on pin #13 to activate relay #1

2. (run as a loop?) if 5 volts reference drops to 0.75 volts on pin #A0, turn off pin #13 to give gear selection control back over to the TCM for running as an automatic transmission, and make pin #6 go low

3. (run as a loop?) if 5 volts reference drops to 2.15 volts on pin #A0,
preform an upshift

ie: if in 3rd gear (relays 3, 4 & 5 all off) turn on relays 4 & 5 and if overdrive lockout indicator light is off (pin #7 = high) pulse pin #8 to turn on O/D LO

4. (run as a loop?) if 5 volts reference drops to 3.05 volts on pin #A0,
preform a downshift

ie: if in 4th gear (relays 4 & 5 and pin#7 high) turn off relays #3, 4 & 5

5. (run as a loop?) if 5 volts reference drops to 1.25 volts on pin #A0,
lock torque converter (turn on PWM on pin #5)

6. (run as a loop?) if 5 volts reference drops to 1.60 volts on pin #A0,
unlock torque converter (turn off PWM on pin #5)

attached is the latest drawing

Thanks Jason

PSDGuy 04-23-2012 12:15 PM

Sorry I did not get back to you sooner, the whole work thing gets in the way. It looks like you have the electrical logic figured out. Now you just need some code - it sounds like AdrianD is helping you out on that front. This is a cool project, now I need to figure out how to do this on my PSD...

BTW, I saw in your sig you have water injection - how do you like it? What type of system do you have? Do you notice any power gains from running just water?

2004LB7 04-23-2012 06:16 PM


the whole work thing gets in the way
i hear you, lately I've been having to work on the weekends, not really complaining though - work is work


I need to figure out how to do this on my PSD
do you have the wiring diagram/schematic for your truck? maybe i can help. wires are wires. don't know much about Fords & not having the truck in front of me will make it that much more difficult. but i will still give it a try if you are interested

as for my water injection, its all home brew
https://www.dieselbombers.com/altern...-6-0-mods.html
check out post #22

dont notice any HP from it (butt dyno). run it to help with exhaust temps and to keep things nice and clean in side. i dont have a pyro gauge so it works mostly on faith

AdrianD 04-30-2012 03:09 AM

Thank you for the further explanations. I am now back home and have access to my Arduino so I will start something. Dummy circuit is the first thing on the order of business

I see no reason not to use on and off buttons for the functions which need it. My suggestion was to simplify wiring.

---AutoMerged DoublePost---

A few more questions, now that I have a basic pseudocode done...

If the transmission is in automatic mode, do upshifting and downshifting still need to be available ? does the torque converter lock-out still need to be available ?

Pin 6 = Rly 2 on/off. What does this control ?

Do you need some delays between steps 1a, 1b and 1c ?

Do you want to be able to control the transmission during the 1 second pulse for O/D or the 1.5 second ramp for torque converter lock ?

2004LB7 04-30-2012 11:23 AM

If the transmission is in automatic mode, do upshifting and downshifting still need to be available ? does the torque converter lock-out still need to be available ?

no to both. i prefer that when the TAP function is "off" then the transmission would work normally and up/down shift and TCC lock/unlock will do nothing when the button is pressed

Pin 6 = Rly 2 on/off. What does this control ?

when the TAP shifting is turned on then the output on pin #6 will be high. this transfers control of the TCC to the Arduino board. pin #5 is what will now make the TCC lock and unlock. relay #2 is needed to prevent the transmission from going into limp mode by tricking it into thinking it is powering a solenoid but it is powering a resistor unstead

Do you need some delays between steps 1a, 1b and 1c ?

only if needed to prevent it from running out of sequence

Do you want to be able to control the transmission during the 1 second pulse for O/D

5th gear is technically overdrive so when in 4th gear then the overdrive lockout will need to be activated to prevent the transmission from upshifting to 5th. when the upshift button is pushed then pin #8 is pulsed to turn off the O/D lock out and allow the transmission to shift to 5th. when the down button is now pushed then pin #8 is pulsed to turn on the O/D lockout to force the transmission to down shift from 5th to 4th.

Pin # 7 is used to monitor the current state of the lockout. if it is high then the O/D lock out is currently on and the transmission cant shift to 5th. i dont know of anything else that will tell us what state the O/D lockout is in other then the light on the dash

or the 1.5 second ramp for torque converter lock ?

when the button for locking the torque converter is pressed (pin #A2 drops to 1.25 volts) then pin #5 will ramp on with a PWM signal. when the unlock button is pressed ( Pin #A2 drops to 1.60 volts) then pin #5 will go low (no PWM signal)

AdrianD 04-30-2012 03:02 PM

Alright, seems like I have most of the pseudocode right.
Basically when the O/D is turned on or off and the torque converter is locker/unlocked the controller will not handle any commands. Is that correct ?

2004LB7 04-30-2012 06:42 PM

the overdrive lockout would work together with the up/down shifting. any gear selected below 5th would have the O/D lockout enabled. when in 4th and the up shift button is pressed all that happens is the lockout is turned off allowing the transmission to up shift to 5th. when the down shift is pressed the O/D lockout is turned back on forcing the transmission to down shift to 4th.

the column shifter only has 1, 2, 3 & D. what we are trying to do is make the transmission "think" that the shifter has been moved between 1, 2, 3 or D. when in "D" the transmission has the ability to shift between 4th and 5th with the O/D lockout function enabled or disabled as needed.

the TCC lockup will be a separate set of buttons (still on pin A2) that will allow you to lock the torque converter at will. it would need to unlock when downshifting to 1st so as to not stall.

with the TCC locked or unlocked the up shift and down shift would still work.

when the controller is active (TAP shift enabled) then all of the commands [up shift/down shift], [TCC lock/TCC unlock] & [turn off TAP shift] are available.

when the TAP shift "off" button is pressed then the controller will turn off all of the relays, PWM and turn off the O/D lockout (enabling 5th gear). all of the up/down shift, TCC lock/unlock buttons will do nothing when pressed. the only thing the controller will be doing at that time is looking for the A2 pin to drop to 0.60 volts (TAP function on button) then it will activate the other functions

hope that make sense

Jason

AdrianD 05-13-2012 07:20 AM

1 Attachment(s)
Hello Jason,

I have compiled a first draft of the code, along with a second program, to check to what does each button voltage mean in ADC units. Comments on how to set it up are in the code. But basically you need to see how many ADC units each button has and set the values accordingly in the first part of the code.

Currently, this first draft only has the flowchart implemented and it does not set or read pins, except the ADC pin. Build the button resistor matrix, connect to the board through the serial monitor of the Ardiono IDE and check how everything works. You will also need to add a 10K resistor between GND and A0 to pull down the ADC to 0.

Please note, while switching the O/D on and ramping up the PWM signal, the controller is blocked in a loop, no other commands work. This is visible in the comments within the code :)
If this behavior is not ok, I will change it, so that the controller is not blocked.

In the meantime, I will work on setting the outputs according to what is needed. This is something you will have to check again, preferably not in the car but with some LED's or just with a DMM, checking all the pins and seeing if the turn on/off according to how it's needed.

2004LB7 05-13-2012 02:51 PM

thank you

i will check it out

2004LB7 05-26-2012 04:54 PM

AdrianD,

so i wired up the button resistor network

it seems as if the controller is monitoring the previous state/value. when pressing any one if the buttons i get the value of 1000~1004. which i believe is the value of the 5 volts

if i hold down one of the buttons and momentarily press another i get the value if the button held down.

here are the values if i hold the buttons as described above

Ohms - volts ---- command -- Arduino value
120 -- 0.26V ---- on ----------- 66-98 ?
390 -- 0.74V ---- off ----------- 147-153
560 -- 0.99V ---- up shift ----- 205-207
1K --- 1.52V ---- dn shift ------ 316-319
1.5K - 1.97V ---- lock---------- 410-414
1.8K - 2.18V ---- unlock ------ 453-459
2.2K - 2.4V
2.7K - 2.66V
5.6K - 3.47V
10K -- 3.95V
22K -- 4.41V

the other ones with no values are extra buttons that are unneeded at this time.

Thanks Jason

2004LB7 05-26-2012 10:57 PM

2 Attachment(s)
ok, using this code and wiring (attached) i was able to come up with these numbers

Ohms - volts ---- command -- Arduino value
120 -- 0.26V ---- on ----------- 51
390 -- 0.74V ---- off ----------- 154
560 -- 0.99V ---- up shift ----- 207
1K --- 1.52V ---- dn shift ------ 319
1.5K - 1.97V ---- lock---------- 414
1.8K - 2.18V ---- unlock ------ 460

Thanks

AdrianD 05-28-2012 03:13 AM

I built my setup the other way around, with the buttons connected to 5v and R1 pulling the ADC to GND. Brainfart, sorry. The whole code was built around that but I'll change it :)

What value is R1 ?

2004LB7 05-28-2012 04:31 PM

1 Attachment(s)
i ended up using a 2.2K ohm. with the 10K and pulling the 5 volts (it is actually 4.86 volts) from the Arduino bord as most of the resistors i used would drop the voltage too much to work.

here is the schematic that will better illustrate why it is wired like this

AdrianD 05-29-2012 01:29 AM

1 Attachment(s)
I think I've figured out why it doesn't work. While pulling to ground, I always checked if the new value is at least 10 ADC units greater than the old value. But on your schematic, if you press a button, the ADC value drops below 1000 to a new value, say 100, the code doesn't catch it and if you hold the button and press another one, the value will jump to over 100 ADC units and it will be caught by the code.

Check this program, it should work ok now, I have not tested it, only going based on what you told me. If it still is iffy, just use the previous version with a different condition, ie. if (prev_input - curr_input > 10)

2004LB7 05-29-2012 01:39 AM

thanks, i will give it a shot.

one thing i discovered is that the relay board i am using requires that the "on" pins be pulled to ground to activate the relays. i guess that means in the programming the pins used on the Arduino board will need to go low or "grounded" when on

AdrianD 05-29-2012 02:39 AM

Test it and let me know :)

The pins can be set to active low or active high but you will need something to be able to drive the relays, the chip cannot drive a relay.


All times are GMT -5. The time now is 12:58 PM.


© 2024 MH Sub I, LLC dba Internet Brands