Shop OBEX P1 Docs P2 Docs Learn Events
Ideas for limiting false frequencies or jitter to propellers input pin in a noisy env — Parallax Forums

Ideas for limiting false frequencies or jitter to propellers input pin in a noisy env

turbosupraturbosupra Posts: 1,088
edited 2012-07-29 15:20 in Propeller 1
My prop is in a noisy environment, and I took my project out of the bench testing phase where I have 2 prop's feeding each other and into the noisy environment and my code failed miserably.

Either the noise is causing my code to fail, or my code is useless so I'd like to rule out or be able to point the finger at the noise, that noise being an automotive environment.

Are there any best practices for cleaning up power inputs in an automotive environment, as well as frequency inputs? Right now I have something close to a standard Darlington Pair that converts a 12v ac sine wave signal to a 3.2v dc square wave signal to be inputted to the prop and my power supply is just the components that came in the kit from Parallax, a 5v regulator and a 3.3v regulator.

Thanks for reading.
«13

Comments

  • kwinnkwinn Posts: 8,697
    edited 2012-07-12 18:39
    Put the circuit in a metal enclosure, add a noise filter to the power input, use an optoisolator for the input signal.
  • JonnyMacJonnyMac Posts: 9,194
    edited 2012-07-12 18:54
    You might use an RS-485 or similar differential line driver between Propellers. You might even use a CAN buss driver chip (MCP2551). CAN was designed for the automotive environment, though a lot of the immunity has to do with the protocol. Still, having a differential driver and using a twisted pair will be helpful.

    BTW, my suggestion only makes sense of the Propellers are separated. If they're in the same enclosure, the shielding and power filtering recommendations are all you can do.
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-12 19:19
    Jon,

    One of the propellers simulates the engine frequencies in the bench setup, but inside of the vehicle I am only using 1 propeller as I don't need to simulate the engine frequencies at that point. If I understood your response correctly I believe I may have misled you into thinking I was still using both in the vehicle?

    JonnyMac wrote: »
    You might use an RS-485 or similar differential line driver between Propellers. You might even use a CAN buss driver chip (MCP2551). CAN was designed for the automotive environment, though a lot of the immunity has to do with the protocol. Still, having a differential driver and using a twisted pair will be helpful.

    BTW, my suggestion only makes sense of the Propellers are separated. If they're in the same enclosure, the shielding and power filtering recommendations are all you can do.
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-12 19:21
    Thank you for the reply, that's a useful idea. Do you have any filters you recommend? The optoisolator is a good idea as well.

    What about the chassis ground, do you think there could be any back feed with that?


    kwinn wrote: »
    Put the circuit in a metal enclosure, add a noise filter to the power input, use an optoisolator for the input signal.
  • jmgjmg Posts: 15,183
    edited 2012-07-12 19:35
    turbosupra wrote: »
    Are there any best practices for cleaning up power inputs in an automotive environment, as well as frequency inputs?

    Series resistance is always good, we often use a PTC 'fuse' and a decent Zener, as both series resistance, and protection.

    For frequency inputs, a schmitt buffer with a RC IP filter is always good to remove 'out of range' signals.
    If you want to add isolation, a Logic opto coupler like the H11L1 is widely sourced, and includes the Schmitt action.
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-12 19:47
    I will look into the H11L1, as I do want to remove the out of range signals if they are present and what is causing my issue, especially if it includes the Schmitt, thank you.

    Since my code works well on the bench, I'm inclined to think it is the environment, although I'm not a very good coder so there is that too.
  • T ChapT Chap Posts: 4,223
    edited 2012-07-12 20:59
    Schematics, photos, pics would help.
  • frank freedmanfrank freedman Posts: 1,983
    edited 2012-07-12 21:06
    Also consider feedthrough caps. Also careful attention to grounding of the enclosures.
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-13 06:30
    Hi,

    If you click on the bottom picture you can see a much larger version and something that indicates where it is on the board. The first picture is the signal conditioning circuit.

    Each signal enters in through the white wires to their 10k resistors

    vvtcircuit2.png

    vvtcircuit1s.png



    T Chap wrote: »
    Schematics, photos, pics would help.
  • T ChapT Chap Posts: 4,223
    edited 2012-07-13 06:49
    Two obvious problems. One is that a breadboard is a big antenna, much more 'wire' beneath the surface. Next, the absence of bypass caps. I would have .1uf all over a breadboard, even a pcb. Each ic needs one on it's power, each input needs one to gnd unless it is some highspeed signal then a smaller value. Every slow signal put a .1 to gnd. All power to prop add more caps.

    You should convert at least to a perf board, all soldered connections.
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-13 07:51
    Thanks for the reply.

    Although I understand the value in having the perfboard/pcb, I'm not sure how it is possible (although I'm open to ideas) as I have no idea how my final layout is going to be.

    I can add the caps (since I convert to dc, should they be polarized?) pretty easily and even put a giant piece of grounded metal under the whole thing or around the whole thing if you think that's a decent idea, but I really need the flexibility to move components around. The i/c's currently are not being used, but were tested for functionality and will be used in the future. At this point I am just trying to get the transistor pairs up and running and functional or the whole project is useless.

    How do people do proof of concept with perfboards/pcbs? The signal is 6khz at highest, 300hz at lowest.
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-07-13 08:14
    >since I convert to dc, should they be polarized?
    Polarized is just a negative side effect requirement with some type of caps and nothing should "look" for.
    Ceramic caps don't have this side effect and with 0.1uF you should definitely go with Ceramic (and up to and including 10uF)
    And you should also make power and gnd connection wires just thin enough to handle the board requirements, as bigger is not better in this case.
  • T ChapT Chap Posts: 4,223
    edited 2012-07-13 08:22
    Place .1uf ceramic(non pol) on all power grids, not a bad idea to add 1 to 4.7uf polarized on the power grids. You have a lot of unsheilded wire including breadboard wire runs. A metal enclosure with gnd to the enclosure would help
  • pmrobertpmrobert Posts: 677
    edited 2012-07-13 08:49
    I have found the LM1815 chip to be quite effective at converting AC auto signals into nice square waves, even in dirty environments.

    -Mike
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-13 09:08
    Thanks everyone, this gives me hope :) ... Am I correct in thinking that if this works well on the bench, that the issue is with noise in the environment?

    So has anyone ever tried shielded wire on the breadboard runs? Is that even reasonable? I will look for a metal enclosure today and map out where I can place capacitors as well.

    @Mike, care to share some details about what type of vehicle, etc? Did you use any specific circuit that is readily available online that I could look at? I see that they use that i/c with the megasquirt as well.
  • T ChapT Chap Posts: 4,223
    edited 2012-07-13 11:16
    http://www.radioshack.com/product/index.jsp?productId=2102845

    For a small project requirement like yours, I like this little radio shack board which has two power busses through the center. You can stack these with standoffs of mount them side by side with screws if you need more room. For a Prop Stick prototype, use one board and single row headers on each side for each connections. Then use another board for the other components. Stack them or side by side, then place in a box. Run GND to the box.
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-13 11:35
    I shall start to try this tonight, thank you.
  • localrogerlocalroger Posts: 3,452
    edited 2012-07-13 11:41
    If there are high frequencies superimposed on your sine wave (which there probably are in a car) you can get jitter at the crossover points. This can be solved entirely in software by debouncing the input -- do not accept that the input state has changed until it stays changed for a certain number of samples. This actually is more effective than trying to solve the problem in hardware and just trusting WAITPEQ.
  • T ChapT Chap Posts: 4,223
    edited 2012-07-13 12:13
    I would replace the input 100k with a 1k, then at the input to Q1 pull that low with 100k.
  • Mark_TMark_T Posts: 1,981
    edited 2012-07-13 12:15
    Well I'd always put such noisy input signals through a schmitt trigger anyhow, 74HC14 is popular for this - CMOS schmitt triggers have about Vdd/2 hysterysis IIRC which ought to nail all but the most extreme interference. 100pF to ground of course at the input to suppress RF.

    Given the incoming signal may be attenuated by the 100k and the possiblity of differing ground potentials I'd consider ac-coupling the input (that way if the square wave ends up being more like 2..10V peak to peak it won't read as constantly high. Alternatively use a resistor divider to bring the 12V range down to 3V.
  • kwinnkwinn Posts: 8,697
    edited 2012-07-13 13:11
    turbosupra wrote: »
    Thank you for the reply, that's a useful idea. Do you have any filters you recommend? The optoisolator is a good idea as well.

    What about the chassis ground, do you think there could be any back feed with that?

    I have used the small inductors (don't recall exact values) that resemble 1/2 watt resistors to add filtering to circuits in noisy environments. In a 12V system they have the added benefit of reducing the power dissipation of the regulator since they also have some resistance. If you use an optoisolator for the signal you could use a PII filter for the power and ground to reduce noise on both.
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-13 14:11
    Alright,

    Components have been sourced and Radio Shack has been raided :)

    I believe I have the Schmitt triggers in my electronics parts, I have to go check though.


    components1.jpg
  • pedwardpedward Posts: 1,642
    edited 2012-07-13 15:13
    Where is the AC signal coming from? I assume you are using the crank position sensor for this? If this is the "standard" CPS, then it is a Variable Reluctance Sensor and you can't use your simple circuit to interface properly. If you use level triggering on a VRS you will get variable timing at different speeds because the signal intensity varies with speed. As suggested before, using an LM1815 is a good solution for this interface, since it's designed for interfacing to a VRS.

    VRS type sensors are very noise resistant, but only if you follow the proper interfacing procedures. You must use a shielded cable, with the shield connected at the PCB ground side, preferably as close to the power supply ground as you can, to create a low impedance path.

    If you follow proper decoupling, grounding, and interfacing guidelines, and use the LM1815 (with the reference circuit they provide), you should be able to see the signal with very little noise.

    You still need to implement filtering and recovery in your code to prevent signal hiccups from torching your process.

    What are you doing with this signal? What does your circuit do? If you have visions of generating a similar signal, you need to understand how zero-crossing interfacing works.
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-13 15:44
    Hello,

    It is a hall effect sensor, both crank position and cam position.

    Do you still recommend looking at the LM1815?

    I may have to do software filtering, if I have the space in my code :(

    I right now I am monitoring the signal and then doing some calculations, I do have visions of generating a modified duplicate signal down the road.
  • pedwardpedward Posts: 1,642
    edited 2012-07-13 15:55
    You may need to do some additional buffering/filtering since it's hall-effect. For certain you will need some filtering and error recovery in software to deal with the noise environment.

    I seem to recall that MegaSquirt users reported a lot of issues with Toyota motors due to noise. Often related to the charging system.
  • jmgjmg Posts: 15,183
    edited 2012-07-13 16:12
    turbosupra wrote: »

    vvtcircuit2.png

    If you have this already, you can craft your own filter/schmitt.from here, with small changes.

    * Add a capacitor across D1, start with around 1nF - exact value depends on signal overdrive amplitude.

    * Join the Q1.Q2 emitters, and insert a resistor to ground, R4.

    * Skew the values or R1 and R3, with R3 smaller.
    A lower R3 gives a higher emitter voltage when Q2 is on, and as Q2 turns off, the falling emitter voltage is positive feedback to Q1, so you get a schmitt action.

    If R3 is 4.7k, and R1 is 10k, then R4 = 220 ohms, will give about 140mV of hysteresis, from a quick calc.
    Easy to run this up on spice.
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-13 16:52
    Here is the other circuit someone helped me with, of which I believe they did something similar to what you suggested.

    components2i.jpg

    jmg wrote: »
    If you have this already, you can craft your own filter/schmitt.from here, with small changes.

    * Add a capacitor across D1, start with around 1nF - exact value depends on signal overdrive amplitude.

    * Join the Q1.Q2 emitters, and insert a resistor to ground, R4.

    * Skew the values or R1 and R3, with R3 smaller.
    A lower R3 gives a higher emitter voltage when Q2 is on, and as Q2 turns off, the falling emitter voltage is positive feedback to Q1, so you get a schmitt action.

    If R3 is 4.7k, and R1 is 10k, then R4 = 220 ohms, will give about 140mV of hysteresis, from a quick calc.
    Easy to run this up on spice.
  • pedwardpedward Posts: 1,642
    edited 2012-07-13 17:22
    The waveform in that image is from a VRS, not hall-effect. An HE sensor produces a square wave and is an open collector transistor. The input actually provides the bias for the transistor "powering" the sensor.

    If you are piggybacking the ECU, you would only need to buffer the input and filter it. IF you are not piggybacking, you need to provide a pullup to 12v to bias the sensor, buffer, and level translate
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-13 18:23
    You are right, I thought the manual had said it had a hall effect, but it does not, it has a VRS ... my apologies for the confusion.

    pedward wrote: »
    The waveform in that image is from a VRS, not hall-effect. An HE sensor produces a square wave and is an open collector transistor. The input actually provides the bias for the transistor "powering" the sensor.

    If you are piggybacking the ECU, you would only need to buffer the input and filter it. IF you are not piggybacking, you need to provide a pullup to 12v to bias the sensor, buffer, and level translate
  • SapiehaSapieha Posts: 2,964
    edited 2012-07-14 10:10
    Hi turbosupra.

    I can't see any decoupling capacitor around PROPELLER on Yours setup!.
    Not mention at least one Tantalum on XTal side of it.

    So I can say that way -- You are lucky that it function for You --- BUT if You will that function in noisy environment -- YOU need add much of them.


    wrote: »
    Hi,

    If you click on the bottom picture you can see a much larger version and something that indicates where it is on the board. The first picture is the signal conditioning circuit.

    Each signal enters in through the white wires to their 10k resistors

    vvtcircuit2.png

    vvtcircuit1s.png
Sign In or Register to comment.