Shop OBEX P1 Docs P2 Docs Learn Events
Running the stamp in the car — Parallax Forums

Running the stamp in the car

jbalatjbalat Posts: 96
edited 2009-08-19 23:44 in BASIC Stamp
Background (in case you havent seen my previous posts)
I am reading a 0-5v square wave signal from the Car 25Hz-200Hz. I modify the frequency and output it via the PWM Pal.
However every few seconds my output signal goes wacko! It goes to a solid 5v or 0v for just a second or so. Obviously the car almost stalls.

One possibility (from many) ?
Just wondering if there would be a need to tie down all the unused stamp inputs with say a 1M resistor and 50pF cap to reduce the possiblity of noise ? Maybe even a small cap across the Car input signal line to the stamp ?

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2009-08-06 12:11
    Usually the only pin that may give you unwanted reboots is the Reset pin. But normally, as long as its completely unattached, there's not an issue.

    I haven't seen your code, but two things come to mind.

    I must assume you're using COUNT to measure the frequency. At 200 HZ, your pulses are 5 msec apart. At 25 Hz they're 40 msec apart. Have you run your system with a variable input pulse stream to make sure you have valid numbers throughout the speed range? The duration parameter has to be suitable for both extremes.

    Secondly, if your program uses IF statements, the old implementation (IF Condition THEN Address) sends the program to a "label" not a subroutine. If you then RETURN rather than GOTO the main program, the program will restart for what seems like no logical reason.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • jbalatjbalat Posts: 96
    edited 2009-08-06 12:41
    I have the super carrier board. How would the reset activate by itself ? I think I read if voltage drops below 0.4v ? Could this happen from an input spike ?

    I am using pulsin. I have just ammended the limits to only allow acceptable time values. I am going out to the car now to see if this works..

    Yes it does transition well from one frequency to another. I had to work out the re-action time of the pwm pal and speed of the processor and allow for it once a new command is issued since it has a nasty habit of not finishing what it had already started.

    I am not using any Returns so hopefully it should be ok

    See my program attached...


    UPDATE
    =====
    Putting the limits on this line worked but just moved the problem somewhere else..
    IF time < 2000 OR TIME > 20250 THEN PAUSE 1 : GOTO Main
    Judging by the poor throttle response it's still getting the bad signal every few seconds but now its harder to detect...

    Post Edited (jbalat) : 8/6/2009 1:01:21 PM GMT
  • stamptrolstamptrol Posts: 1,731
    edited 2009-08-06 14:23
    I think it is the IF Then Pause 1 statement.

    You're using the old form of the IF THEN and getting away with it during tokenizing because there is one ENDIF, but its really related to your second IF THEN statement.

    Sometimes the lack of ENDIF gets triggered and the processor restarts.

    Replace

    IF time < 2000 OR TIME > 20250 THEN PAUSE 1 : GOTO Main


    with

    If time < 2000 or Time >20250 then
    Pause 1
    Goto main
    Endif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • jbalatjbalat Posts: 96
    edited 2009-08-07 00:12
    Tom thanks for your feedback..

    I hope it is just a code issue and not signal related.

    Will try to see "if" the new "if" makes a difference [noparse];)[/noparse]
  • jbalatjbalat Posts: 96
    edited 2009-08-08 12:54
    Not sure if it made a difference.

    Signal looks ok on oscilliscope but car is still jumping around even when I set the modified frequency to 99% of the original.
  • stamptrolstamptrol Posts: 1,731
    edited 2009-08-09 12:06
    Are you sure PULSIN is the way to go? I had a look at the HELP file and it is designed to measure the width of a pulse, not frequency directly. In the write up, there are a couple of examples that show that it can time out and return 0, which would cause the jumpiness you're seeing.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • Alan BradfordAlan Bradford Posts: 172
    edited 2009-08-09 19:41
    Hi,
    I have also noticed that the Stamp will reset on Plasma Cutting Machines. They start with a small spark at the torch.
    If I leave the Serial Cable connected the Stamp will restart 50% of the time.
    The Spark Plugs, wires, ignition coil, etc can be causing noise to get on the ATN line and forces a Reset.
    The way to see if this is the problem is to put a routine at the startup that blinks an Led or a short delay so you know positively that it did a reset.
    I put a .1 uf cap in series with Pin 3 (ATN) and another .1uf from pin 3 to ground. (I have heard that .01 caps work also.)
    You shopuld make sure that the power supply is bypasses with .01 uf and 300 UF caps.

    Hope this helps,



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Alan Bradford ·N1YMQ

    Plasma Technologies
    Canaan NH 03741
    www.plasmatechnologies.com
  • jbalatjbalat Posts: 96
    edited 2009-08-09 23:51
    Red Led
    Wow I just got it.. The flashing LED on bootup is a great idea !!!
    I was also going to try a Red LED to indicate when the input signal was bad....

    Re PULSIN ?
    When running the stamp on the bench using another stamp to feed it with a signal it ran just fine. I even pulled the signal out and back in and no problems. PULSIN seems to work well. Would you recommend anything else ? I noticed that when the battery died on the first stamp the output went crazy which is not code related.

    Noise
    I will try the capacitors.
    You mentioned pin 3 (which I assume is the Reset line)
    Can you explain what needs to be done on my signal input line and my 12v Power in ? (The super Carrier board can handle up to 30v input)
    What about the unused inputs, should they also be tied down ?

    Powering my Sensor
    I am using 5v VDD from the super carrier board to power the sensor (which I think only needs about 4mA). The sensor is then creating the square wave from this and sending it back down my input line (Pin7). Do you see this as an issue ? Should I try to get the 5V to my sensor from somewhere else ?.
    The square wave is caused by a mechanical means using a phototransistor and a moving mirror. Could this cause some kind of shock similar to a relay ? If so how do I protect from this ?


    Thanks,
    JB

    Post Edited (jbalat) : 8/10/2009 4:55:26 AM GMT
  • jbalatjbalat Posts: 96
    edited 2009-08-11 09:18
    OK tried the Red LED.. 3 flashes on bootup and 3 ms flash when signal is out of bounds.

    Good news.. Board is not Resetting !!

    Bad news.. Every 4-5 seconds the input signal is bad for a half a second or so.
  • Alan BradfordAlan Bradford Posts: 172
    edited 2009-08-11 13:05
    Hi,
    I do not use the super carrier board so Im not sure about the power supply.
    I spin my own boards. I use a TI switching regulator to convert the input DC to +5V.(PT5101N Digikey pn· PT5101N-ND) They cost about $12.
    This is good for 10-38 volts input. Being a switcher it does not waste the excess voltage as heat and runs cool.
    I put a 3000 uf cap on the input and a 300 uf cap on the output.
    This works for electrically noisy industrial drive systems.

    Can you write another program to run as a test and see if it fails.
    This could help spot if it is in your pulse input circuit/code or noise on the other inputs.
    Have it just blink an led and see if that gets interupted.

    Nave you tried to isolate your pulse inputs with an optoisolator?
    Maybe transients from the pickup coil are the cause of the problem.
    Im not sure what you are doing so it is hard to come up with suggestions.
    I am assuming you are working with the ignition system, as the frequency seems like the rate for spark plugs in a 4-8 cyl 4 stroke gas motor.

    If you could post your schematic it would be easier to help out.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Alan Bradford ·N1YMQ

    Plasma Technologies
    Canaan NH 03741
    www.plasmatechnologies.com
  • Alan BradfordAlan Bradford Posts: 172
    edited 2009-08-11 13:08
    BTW,
    I would assign the unused Inputs as Outputs and put a 100k resistor to +5 from the unused pins to pull them up.
    This should eliminate them as a problem

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Alan Bradford ·N1YMQ

    Plasma Technologies
    Canaan NH 03741
    www.plasmatechnologies.com
  • stamptrolstamptrol Posts: 1,731
    edited 2009-08-11 13:57
    Back to the test setup. When you say the system worked with a Stamp as the source, did you run it over the full speed range?

    Does your sensor have a Schmitt trigger stage to keep the wave form shaped properly at both high and low speeds?

    If the Stamp is not resetting, and works with a simulated pulse stream input, the only suspect left is the pulse stream during actual operation.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • jbalatjbalat Posts: 96
    edited 2009-08-11 23:50
    "did you run it over the full speed range?"
    Yes.. I checked the frequency with an oscilliscope at idle, and various frequencies. It would probably drop below the minimum while the car was about to stall or while warming up but I am experiencing problems over the entire range

    "Does your sensor have a Schmitt trigger",
    Wave coming from the sensor looks square on my oscilliscope. If you see my pic karmen.jpg at the link below. It is a maf sensor that supposedly works off vortices making a mirror move and turn a led on and off. The weird this is that it needs to be powered and sends the signal back the same wire. See my stamp install.jpg to see if I have wired it up ok ?

    "I do not use the super carrier board..."
    I tried powering the board with a 9V battery just in case and still get the same problem

    I know this is a pain. but if you scroll to the bottom of this post I have uploaded all kinds of pics and charts
    http://forums.parallax.com/showthread.php?p=826554

    Post Edited (jbalat) : 8/12/2009 4:42:33 AM GMT
  • stamptrolstamptrol Posts: 1,731
    edited 2009-08-12 12:21
    I had a look at your MAF transmitter diagram. Just a bit confused by your comment that it is powered and the signal comes on the same wire. In the diagram, its clearly powered by 5 VDC and the signal is a transistor sinking to ground with a pullup to +5.
    In the stampinstall.jpg, I'm a bit suspicious of the 1K in series with the power to the MAF. From looking at the diagram, you would power the unit with solid +5, provide a ground and receive the squarewave on p7 via a separate wire. The sensor curve quotes a 3.8 volt p-p, so with the 1K in series, you would likely not be getting full swing at higher frequencies.

    Onward and upward

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • jbalatjbalat Posts: 96
    edited 2009-08-12 13:19
    Stamptrol, I really appreciate you having a look at it for me. So I can remove the 1K which may boost the voltage to the MAF a little.

    When you say receive the squarewave on a seperate wire I assume you mean Pin 7 on the stamp in which case the 5V from VDD on the stamp board and the Pin7 wire both connect to the same point on the MAF. Is this ok ? or should I source 5V from elsewhere ?
  • stamptrolstamptrol Posts: 1,731
    edited 2009-08-12 14:00
    Again, I'm just looking at the MAF diagram. Three wires to the sensor. +5, signal, ground. In the top right of the karmen diagram Vcc=5v, Ks=signal, E2=ground.

    Stamp p7 >>> to Ks on sensor
    Stamp Vss >>> to E2 on sensor
    Stamp +5v >>> to Vcc on sensor

    At the Stamp, put a pullup from p7 to +5volts (anything from 10K down to about 1K)


    Hope this helps.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • jbalatjbalat Posts: 96
    edited 2009-08-12 23:46
    Stamptrol (Thanks again for replying !!!)

    Just for Clarification.

    - The Karmen Diagram on the right is the reference design.
    - My actual setup is on the Left.
    - MAF(3) is the signal which goes to ECU(10)..
    - I have no idea what MAF(7)-ECU(57) does, I couldnt measure any voltage or pulse and do not use this at all.


    With that in Mind..

    "Stamp Vss >>> to E2 on sensor" - Not sure where this is, I just connected to Earth and ECU(5) Black

    "Stamp p7 >>> to Ks on sensor" - Cut wire MAF(3)-ECU(10) and connected to MAF(3)

    "Stamp +5v >>> to Vcc on sensor - Cant get to this Connected again to MAF(3) using 1K resistor

    Stamp p12 >>> to ECU(10) - Output signal from Stamp to ECU

    "At the Stamp, put a pullup from p7 to +5volts (anything from 10K down to about 1K)" - If you look at the attachment Stampinstall2.jpg I have 2 wires going to the signal wire of the MAF(3).. I assume this is equivalent to putting a 1K resistor from Pin7 to VDD. Forgot to mention that once I cut the MAF(3)-ECU(10) wire the MAF lost its power source so I assume Mitsubishi have saved 10cents on a seperate wire for power by using the same wire unless this is done internally in the ECU.

    I have attached the mafsensor.jpg which is my interpretation of how my MAF works with the ECU on 1 wire ?

    Looks like I have wired correctly. Sorry for dragging this on and really appreciate your help...

    Oops mafsensor.jpg updated...

    Post Edited (jbalat) : 8/17/2009 8:11:46 AM GMT
    555 x 676 - 59K
    542 x 132 - 13K
  • jbalatjbalat Posts: 96
    edited 2009-08-17 05:16
    Anyone ????

    Do you think my wiring is ok ?


    UPDATE UPDATE
    ===========

    Just replaced the 1K Resistor with a 10K Resistor and attached a 47pF capacitor back to ground from the resistor and guess what..

    Input Signal is GOOD !!

    Car still keeps jumping a little but much more driveable

    Post Edited (jbalat) : 8/17/2009 10:46:57 AM GMT
  • stamptrolstamptrol Posts: 1,731
    edited 2009-08-17 13:10
    Hi,

    Your recent sketch addresses my original concern, but I take it that things are still acting up.

    Will the system work when you don't modify the the output frequency?

    Also, where pulsein measures pulse-width, not frequency, would it be worth it to try the count function as well?

    The other possibility is to use one of the PWMPAL inputs as high speed counter to read the input frquency rather than have the Stamp do it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • jbalatjbalat Posts: 96
    edited 2009-08-17 23:41
    Yes system works fine at constant frequency and works well while adjusting up/down on the bench it is also looking good in the car on the oscilliscope but as you said I still have a few issues to sort out.

    I am thinking that the MAF was draining too much current from the Stamp VDD so the higher resistor helped ?

    I was thinking of a voltage divider to reduce the signal voltage lower so that the low is further from 1.4v trigger point. I have measured between 0.8v-1.1v

    I would love to figure out how to use the PWM Pal counter to read the frequency ? I then need to modify the count by a factor and output a lower count.. Can this be done without a clock ? Any ideas welcome... UPDATE... What am I saying. I have 4 PWM counters I could just set one of those up as a clock !

    Post Edited (jbalat) : 8/18/2009 11:37:17 PM GMT
  • jbalatjbalat Posts: 96
    edited 2009-08-19 23:44
    Ok cool I just figured out the problem. When the car is under load the MAF Frequency goes beyond what I thought it would.. around 277Hz at 3000rpm
    My program was chopping this off therefore not squirting in enough fuel making the car stutter.

    When I allowed a higher frequency though the car kept dying and would not even idle.. Need to investigate further... Still thinking it is a PULSIN issue and will try to use the PWM counters somehow ?
Sign In or Register to comment.