Hyundai Forums banner
1 - 20 of 24 Posts

·
Registered
Drives : Nissan NV200 Flies : Rans S6ES
Joined
·
17,128 Posts
Discussion Starter · #1 ·
Hello folks.

So, for a while now I've been thinking of buying one of these Arduino development boards to tinker with and although they aren't particularly expensive bits of kit, I didn't want to buy it just to make a few LEDs flash then throw it in a drawer to gather dust. I wanted a project that would use the Arduino to do something useful, preferably something auto electrical so I'd have half a chance of making it work. So what I've decided to try and do is make a home brew cruise control system. I've read a few posts from other folk on the forum that have been lucky enough to just add OEM cruise control switches to their cars and the cruise control just works with no further modification. Unfortunately Hyundai never offered cruise control as an option on my model (Getz) so simply adding switches doesn't work...I already tried :frown:

Anyway, my Arduino is on order. It's a Chinese clone actually but was being sold on the bay by a UK based seller so I should hopefully have it in a few days. This one was £8 but if your willing to wait on your board arriving on the slow boat from China, you can buy one for less than half that. I've also ordered an LCD display unit, £7. Not really necessary for a cruise control system but I thought it would be useful to display the results of the calculations in the code in real time so I can see if things are working as I expected them to. It should save me from having to read the laptop screen while I'm driving when I'm trying to fix the inevitable bugs in my code. I've ordered a few other bits 'n' pieces that I think I'll need too. All in I've spent just shy of £25 so if I can get a working cruise control system for that kind of money I'll be more than happy. But even if it doesn't work out I'm sure I'll learn a bit of computer programming and a little bit about electronics along the way so it wont be a total waste.

I'll be making further posts here as the project progresses so keep an eye open for new posts if your interested in seeing it come together. We'll see how many Arduino boards I melt before I make it work :surprise: Maybe I should put an order in for some spares now and hopefully they'll have arrived on that slow boat by the time I melt the first one :laugh:

Cheers.
Scottie.

For those that don't know what an Arduino is ---> Arduino Uno
 

·
Registered
Joined
·
13,373 Posts
They sell Arduino kits here in the US at Radio Shack stores for $99.99....

You should get together with James Pucell...he's trying to do an Infotainment system. You could combine projects. Let me know when you get XM working...;)

Except he's using a Raspberry Pi.
 

·
Registered
Drives : Nissan NV200 Flies : Rans S6ES
Joined
·
17,128 Posts
Discussion Starter · #4 ·
Finally getting around to updating this thread. Unfortunately, or fortunately depending on how you look at it, I've been really busy with work recently and I've not had much time to spare to work on my cruise control project. Work has presented different opportunity to develop an auto electrical Arduino based project though.

Someone heard I had been doing quite a bit of work on some engine transplants recently. I've been making wiring looms for fuel injected BMW bike engines to make them fit into 1970's vintage Hillman Imps and other Imp based cars. Anyway, this guy gets in touch to ask if I could help him with a project he's working on. He has a Jaguar XJ40 that originally had a 6 cyl petrol engine and he has replaced the Jag engine with a BMW diesel engine (that he intends to run on old cooking oil.....cheap as chips). The problem he has is the rev counter signal on the diesel engine, which comes from the alternator, is totally different to the signal that was used to drive the rev counter on the original Jag engine and he asked if I could come up with a circuit that would interface the BMW engine with the Jag rev counter. I've had to tackle similar problems to this on the BMW bike engines because they have a wasted spark ignition system that isn't able to directly drive the original Hillman Imp rev counter which was made to work with the 1970's points ignition. On the bike engines it was a case of combining the two coil trigger signals of the wasted spark ignition into a single wire that could be connected to the Hillman rev counter. Not as easy as it may sound but after a bit of head scratching I managed to make it work. The problem with the BMW diesel engine is I have no idea what the signal output from the alternator is and I don't have access to the car to test it (it's on the other side of the country). So I decided to have a go at building a programmable signal convertor based around the Arduino Uno I bought for my rev counter project. The idea is the guy can connect the engine speed signal to an input on the Arduino and use a couple of buttons to adjust the frequency of an output signal that will drive the Jag rev counter. That way the end user can just program the circuit himself and I don't need to drive across the country (OK, I know Scotland is only 50 miles wide) to make any measurements with my oscilloscope.

Below is a wee demo video of my circuit for your amusement. I hope I have some news on the cruise control project soon.

Cheers.
Scottie.

 

·
Registered
Joined
·
13,373 Posts
Finally getting around to updating this thread. Unfortunately, or fortunately depending on how you look at it, I've been really busy with work recently and I've not had much time to spare to work on my cruise control project. Work has presented different opportunity to develop an auto electrical Arduino based project though.

Someone heard I had been doing quite a bit of work on some engine transplants recently. I've been making wiring looms for fuel injected BMW bike engines to make them fit into 1970's vintage Hillman Imps and other Imp based cars. Anyway, this guy gets in touch to ask if I could help him with a project he's working on. He has a Jaguar XJ40 that originally had a 6 cyl petrol engine and he has replaced the Jag engine with a BMW diesel engine (that he intends to run on old cooking oil.....cheap as chips). The problem he has is the rev counter signal on the diesel engine, which comes from the alternator, is totally different to the signal that was used to drive the rev counter on the original Jag engine and he asked if I could come up with a circuit that would interface the BMW engine with the Jag rev counter. I've had to tackle similar problems to this on the BMW bike engines because they have a wasted spark ignition system that isn't able to directly drive the original Hillman Imp rev counter which was made to work with the 1970's points ignition. On the bike engines it was a case of combining the two coil trigger signals of the wasted spark ignition into a single wire that could be connected to the Hillman rev counter. Not as easy as it may sound but after a bit of head scratching I managed to make it work. The problem with the BMW diesel engine is I have no idea what the signal output from the alternator is and I don't have access to the car to test it (it's on the other side of the country). So I decided to have a go at building a programmable signal convertor based around the Arduino Uno I bought for my rev counter project. The idea is the guy can connect the engine speed signal to an input on the Arduino and use a couple of buttons to adjust the frequency of an output signal that will drive the Jag rev counter. That way the end user can just program the circuit himself and I don't need to drive across the country (OK, I know Scotland is only 50 miles wide) to make any measurements with my oscilloscope.

Below is a wee demo video of my circuit for your amusement. I hope I have some news on the cruise control project soon.

Cheers.
Scottie.

http://www.youtube.com/watch?v=g7ZYLOiKH3M&feature=youtu.be
That's a heck of a scope you got, Sparky!

Last one I used was one of these...



Also, glad to hear you guys haven't learned English yet. It'll be a sad day when everyone talks like 'mericans...
 

·
Registered
Drives : Nissan NV200 Flies : Rans S6ES
Joined
·
17,128 Posts
Discussion Starter · #6 ·
That's a heck of a scope you got, Sparky!

Last one I used was one of these...
Yeah, I think it would be a bit difficult to go on test drive with that one on my lap :laugh:

Old's Cool said:
Also, glad to hear you guys haven't learned English yet. It'll be a sad day when everyone talks like 'mericans...
Are you able to understand my Glaswegian accent?

Actually, I was using my best BBC Scotland TV presenter accent in the video. If I spoke the way I normally do there would be a lot of words bleeped out and I'd probably need to add subtitles so anyone outwith the central belt of Scotland could understand me.
 

·
Registered
Drives : Nissan NV200 Flies : Rans S6ES
Joined
·
17,128 Posts
Discussion Starter · #8 ·
Made a little bit of progress with the rev counter driver circuit.

I've swapped the Arduino Uno for a Nano so I can keep the Uno for my cruise control project.
I've fitted a Schmitt trigger to the input of the circuit to convert the input signal to a square wave that the Arduino can measure. I've fired sine waves and even triangle waves into it and the Schmitt always outputs something square enough for the Arduino to work with so I'm confident enough that it's gonna work that I've gone ahead and built a proper circuit on some vero board. I also added a transistor to the output to convert the 5V output from the Arduino into a 12V signal that the car's rev counter will be expecting to see, and I found an old parking sensor control unit that I've robbed of it's box...photos below :

Circuit CAD drawing


The Real Thing


The Real Thing...Boxed

 

Attachments

·
Registered
Drives : Nissan NV200 Flies : Rans S6ES
Joined
·
17,128 Posts
Discussion Starter · #9 ·
No work today so I wired up my rev counter driver thingy to my Hyundai Getz to give it an on vehicle test.

And it worked....WOW!

Below is a short video of my test. It's a 10min long video that took about 2 hours to film. As soon as the camera starts my normally quite neighbourhood suddenly gets right noisy. The police helicopter decided to hover over me during the first attempt. My neighbours kids came to quiz me about what I was up to at the second attempt. Then a plane thought my house was a good place to take up a holding pattern, then some guy started a chain saw. I was beginning to think I was the victim of one of those hidden camera prankster TV shows. I was half expecting Jeremy Beadle to turn up is some dodgy "man from the council" disguise. Aye, I know....showing my age a bit there :laugh:

 

·
Registered
Drives : Nissan NV200 Flies : Rans S6ES
Joined
·
17,128 Posts
Discussion Starter · #10 ·
So now that I've got my Arduino Uno back having replaced it with a Nano in the rev counter driver circuit, I finally got round to doing some work on this cruise control project.

The system is going to be made up of 3 parts.
1. An input circuit that will convert the pulses from the Vehicle speed sensor into a voltage that the Arduino can read. I'll also have the inputs from the brake & clutch pedal switches and the cruise control control switches being sent to the Arduino via the input circuit.
2. An output circuit that will convert the output of the Arduino into throttle command voltages that will be sent to the engine ECU. My car has a diesel engine so there isn't a throttle valve to attach an actuator to. It's a "drive by wire" throttle and my plan is to simply use the Arduino to simulate the throttle pedal to control the vehicle speed.
3. The Arduino itself.

The electronics that make the cruise control system (CCS) work are very simple. They needed to be 'cause I don't know a great deal about electronics. I just know what I had to learn to pass my amateur radio exam back in the early 90's. I had an idea what I was going to need to make the CCS work so I just used Google to find folk who were working on similar projects and shamelessly stole their work and modified it to suit my needs. No point to me reinventing the wheel, even if I was smart enough to be able to.

The first thing I needed was a frequency to voltage convertor to convert the output pulses from the VSS into a voltage that the Aruino could read. After a quick Google search I came across a guy who was making some sort of digital speed display for a lathe...circuit diagram below. It was an Arduino based project so the circuit was exactly what I needed. I only changed two components. I didn't need the LED so I swapped that for a normal diode and I didn't have a 100 kilo Ohm potentiometer (R1) so I swapped that for a 30k fixed resistor. I tested the circuit using the signal generator in my oscilloscope to simulate the VSS. That confirmed the circuit worked so just for a giggle I connected it to the OBD connector on the car and took it for a test drive. I used my scope to record the output voltage at different vehicle speeds...plot below. I then added a little button that will be the SET control for the CSS. I wrote a little Arduino sketch that reads the output voltage of the circuit and displays the vehicle speed on the LCD display. When I press the SET button the program stores the speed the car was travelling at when the button was pressed and displays the set speed too. Not really very useful but I just did it as a programming exercise. A couple of hours work and I had made a digital speedo...YAY!

I'll be back with the output circuit in the next exciting update.

Scottie.

The circuit that converts the VSS pulses into a voltage that's
proportional to the VSS signal frequency.



Voltage against Speed plot


Digital Speedo
 

Attachments

·
Registered
Drives : Nissan NV200 Flies : Rans S6ES
Joined
·
17,128 Posts
Discussion Starter · #11 ·
Cruise Control System Part 2.

I injured my wrist over the weekend so can't work this week. But I consider the cruise control system recreation so I've made a little more progress.

Just a quick recap of where I'm at. I've built a circuit that counts the ouput pulses from the Hyundai Vehicle Speed Sensor (VSS) and outputs a voltage that's proportional to vehicle speed. This voltage is sent to one of the analog inputs on the Arduino microcontroller and there is a little bit of code that converts the voltage into a MPH speed value. I have a (SET) button connected to one of the Arduino's digital inputs and when a button press is detected the current vehicle speed is saved into a variable in the code. The current vehicle speed and the "set" speed are displayed on the LCD screen (although that wont be part of the finished project).

So, now that I've got a vehicle speed into the Arduino I need figure out how to make the Arduino control the engine throttle to try and maintain the set speed. As my car has a "drive by wire" type throttle, the plan is to use the Arduino to simulate the throttle pedal.

Inside the pedal there are two sensors, APS1 & APS2, that output voltages that are proportional to how hard your pressing on the pedal...see below. The harder you press on the pedal the higher the output voltages will be. The two sensor don't output the same voltage though. One sensor (APS2) outputs a voltage that is half that of the other sensor (APS1). These voltages are closely monitored by the engine PCM and if the voltages go out of limits or the 2:1 ratio of APS1:APS2 signals is lost, the PCM logs a trouble code and can put the throttle into default/limp mode which stops the engine from responding to throttle inputs. So I need to be careful what I'm doing here as there are obvious safety concerns if I was to suddenly loose throttle control, either by causing the PCM to enter default or by outputting the wrong voltages from the Arduino maybe causing uncontrolled acceleration.

I had originally planned to use the Adruino to generate both the simulated APS1/APS2 voltages but I learned a little bit about opamps while making the rev counter driver project shown above (the schmitt trigger in the rev counter driver uses an opamp) and I've decided to generate only the lower APS2 voltage in the Arduino and use an opamp configured as a voltage amplifier with a gain of 2 to double that voltage for APS1. That will ensure that the 2:1 voltage ratio is maintained regardless of what comes out the Arduino. Schematic of the cruise control's output circuit shown below.

I'll try to explain what is going on in the output circuit.
The output from the Arduino is a PWM signal (pulse width modulated) and that is converted to a DC voltage by the low pass filter made up of R1/C1. The DC voltage is sent to the input U1.1 which is one half of a dual opamp integrated circuit (micro chip). This first opamp is configured as a voltage follower/buffer amplifier, and it's output is sent to the normally open terminal of the relay 2 (APS2 relay). The U1.1 output is also sent to the input of U1.2 which is the second opamp configured as a voltage doubler (X2 Amplifier). The output of U1.2 is sent to the normally open terminal of relay 1 (APS1 relay).

The throttle pedal sensor signal wires will be cut. The pedal side of the cut is connected to the normally closed terminals of the relays. The PCM side of the cut is connected to the common terminals, allowing the PCM inputs to switch between the pedal and the Adruino. When the relays are switched off the throttle inputs to the PCM will come from the throttle pedal. When the cruise control SET button is pressed one of the Arduino digital pins is set HIGH. That pin is connected to the base of transistor Q1, switching the transistor on which in turn switches on the two relays. When the relays switch on the PCM throttle inputs are switched over to the outputs of the two opamps allowing the Arduino to control vehicle speed....hopefully.

Something that might throw a spanner in the works...I said above that the APS1/APS2 voltages are closely monitored by the PCM. What might cause a problem is the switching of the two relays. When the switches inside the relays are moving between the NC/NO contacts there will be a point in time when the APS signal wires will be open circuit. That might cause the PCM to log a code or even put the throttle into limp mode. The switch moves from one contact to the other almost instantly though so I'm hoping the PCM isn't monitoring those voltages too closely. Before I start writing code to try and control the throttle I'll need to make sure the switching of the relays doesn't cause a trouble code to be logged in the PCM. I'm not sure how the project could proceed without the relays so there wouldn't be much point to me trying to writing any code if they cause a problem.

I've built the output circuit this evening and hopefully I'll get to at least test the relay switching tomorrow. I think that's pretty much all the electronics side of things complete and it should just be a matter of writing some code now to make it all work...watch this space...

Four Stitches - It wasn't intentional....Honest



Throttle Pedal Sensor Data From The Hyundai Manual


Arduino Throttle Control Circuit
 

Attachments

·
Registered
Joined
·
13,373 Posts
I would have clicked "Like" but liking an injury isn't exactly kosher...

Nice work (on the unit).
 

·
Registered
Drives : Nissan NV200 Flies : Rans S6ES
Joined
·
17,128 Posts
Discussion Starter · #13 · (Edited)
Sorry this thread didn't really come to anything. I did make a working prototype cruise control from the Arduino Uno and it worked quite well...see below.

The project kinda stalled when the hard drive in the netbook I was using to write the Arduino code failed and I lost the code. I had a paper copy of it and was meaning to sit down and retype it all in but before I got around to doing that I sold the Getz. Anyway, i came across a wee video of the prototype in action on my phone so I thought I'd post it as a final update to the thread.

I started this project just as a way to learn a bit about the Arduino series of micro controllers and it served it's purpose in that respect. Maybe one day I'll resurrect the project and fit it in my Nissan van....watch this space :smile:

Regards.
Scott.






 

Attachments

·
Registered
Joined
·
12 Posts
Did you ever end up trying to port the project over to your nissan van? I am planning on doing the same thing with my 99 volkswagen passat, and will use this thread heavily to try to model my arduino logic after. I am experienced with c/c++ development, but not so experienced with circuitry. My passat is not drive by wire though, it is drive by cable, so that will require some fundamental changes to parts of your project. The existing cruise control uses a a vacuum pump to pull the throttle body, so i plan on running the vacuum pump input signal.

Any recommendations? did you ever end up rewriting the code?
 

·
Registered
Drives : Nissan NV200 Flies : Rans S6ES
Joined
·
17,128 Posts
Discussion Starter · #15 ·
Did you ever end up trying to port the project over to your nissan van?
No, not yet. I'm sure I'll get around to it some day though. I've bought a canbus interface for the arduino but I've not had a chance to hook it up to the van yet to see if I can pull the vehicle speed data from the data bus. The Nissan doesn't have a dedicated vehicle speed sensor, AFAIK.

Tiuipuv said:
am planning on doing the same thing with my 99 volkswagen passat
I was the AUTOSPARK in a VW dealership so I've installed quite a few CCS to VW cars. They've all been later drive by wire models though. It's about a half hour job to install a system on those newer models. You basically just replace the turn signal stalk switch for one with the cruise control button then activate it with the diagnostic tool.....simples! It would probably be just as simple to install the factory system to the Nissan too, but that's not as much fun as building your own :)

Tiuipuv said:
The existing cruise control uses a a vacuum pump to pull the throttle body, so i plan on running the vacuum pump input signal.
Your planning on using the arduino to control the vacuum pump? Is the vacuum pump electric? I'm not familiar with your particular model but vacuum pumps are normally mechanical.

Tiuipuv said:
did you ever end up rewriting the code?
No. I'm sure I'll get around to that some day too though.

Good luck with the project.
 

·
Registered
Joined
·
12 Posts
Due to moderation problems, I have to reply in chunks, otherwise it won't let me post a reply:

No, not yet. I'm sure I'll get around to it some day though. I've bought a canbus interface for the arduino but I've not had a chance to hook it up to the van yet to see if I can pull the vehicle speed data from the data bus. The Nissan doesn't have a dedicated vehicle speed sensor, AFAIK.
Yeah, the passat has a speed sensor. I believe based on the Bentley test that they recommend doing (for testing the cruise control module) that my speed sensor is just an osscilating sine wave, so your physical circuit should also work for my application.
 

·
Registered
Joined
·
12 Posts
Due to moderation problems, I have to reply in chunks, otherwise it won't let me post a reply (2):

I was the AUTOSPARK in a VW dealership so I've installed quite a few CCS to VW cars. They've all been later drive by wire models though. It's about a half hour job to install a system on those newer models. You basically just replace the turn signal stalk switch for one with the cruise control button then activate it with the diagnostic tool.....simples! It would probably be just as simple to install the factory system to the Nissan too, but that's not as much fun as building your own :)
I have had quite the battle with my cruise control. My car has a cruise control setup already, it just wont ever be revived with the stock setup....

my main resource is this forum post, one of the few remaining with some pictures:
https:// www. vwforum .com/forums/f 14/cruise-control-boa rd-repair-39805/
(i had to put spaces in there as I am too new to the forum to post links haha)

Firstly, I did the 'Bentley' test, which is essentially making sure that the car wiring is good using a volt meter and jumper wires. I verified that my stalk is still good with every button functioning as expected, and that the electric vacuum pump runs when a jumper is across two pins, and that it hold vacuum after it stops running. Also verified the clutch switch and brake switch release the pedal back to the floor.

So by that logic, it has to be the module. So i tried repairing the original, then bought another 'good' used one (didn't work), and finally caved and bought a third 'good' used one that didn't work. Did the bad solder joint re-soldering and new internal relays on all 3.

Alas, arduino must rescue me.
 

·
Registered
Joined
·
12 Posts
Your planning on using the arduino to control the vacuum pump? Is the vacuum pump electric? I'm not familiar with your particular model but vacuum pumps are normally mechanical.
Yeah, the vacuum pump runs when a jumper crosses pins 2 and 4 (part of the Bentley test), so it is how i plan on interfacing with the throttle body. It must be electric in order for it to run while the car is not running.

Hopefully I can get somewhere on the project, its unlikely considering my lack of direct wiring diagram for the vehicle, but i plan on trying some load tests on some of the known pins this weekend, and maybe getting my hands on some mosfets in the coming weeks to start laying out some 12 volt to 5 volt micro-controller interaction. If you have any remaining documentation/design pictures or info that is not on this thread already, they would be much appreciated at pointing me more towards success. If i ever get it working, i will definitely let you know here.
 

·
Registered
Drives : Nissan NV200 Flies : Rans S6ES
Joined
·
17,128 Posts
Discussion Starter · #19 · (Edited)
So i tried repairing the original, then bought another 'good' used one (didn't work), and finally caved and bought a third 'good' used one that didn't work. Did the bad solder joint re-soldering and new internal relays on all 3.
Given that you have tried 3 different modules, are you sure you haven't maybe missed something in the wiring tests?

When you switch on the cruise control with one of your modules connected is there a warning light shown on the instrument cluster to tell you it's switched on?
Did you actually do the speed sensor test mentioned in the Bentley test plan? The guy who posted the test plan says :
"skip this one. Tests wheel speed sensors and if you speedo works. Then this'll work too".

He's making a stupid assumption here. The speedo working does not guarantee that there is a speed signal being input to the cruise control module. If that was the case the Bentley test plan wouldn't have you physically measuring it. They'd just tell you to look at the speedo. Obviously, your cruise control can't work without a speed input.
 
1 - 20 of 24 Posts
Top