Mysterious transients in RC signal driving ESC

Some time ago I posted a YT series following an ongoing project I've been working on (https://forum.arduino.cc/t/the-electric-turbo-camaro-project/680124): In essence I've used an Arduino Mega (and pretty much all of the pins on it) to completely automate the task of monitoring my car's vitals and deciding if, when and how to run an electric supercharger which is mechanically de-coupled and powered by batteries. The Arduino is responsible for monitoring what the car is doing, deciding how to apply boost and also running a touch screen interface with complete GUI to control and get feedback from the system. I have conducted several successful tests and am convinced the system does all the things it's supposed to do in some capacity.

The problem all along has been that I could never get EVERYTHING to work. At first, the blower itself was too weak because it was wound incorrectly. After fixing that the batteries were the bottleneck. I bought new ones and now I'm experiencing these odd transients in the radio signal I'm generating... I'm not sure if it's the ESC, loose wiring or the Arduino. However the more I stare at the data the more I think it's probably the Arduino and more specifically, the code. You'll see what I mean from the attached images.

In the ESC's native logging graph (untitled), you can see the normal ramping up of the RC signal, as pre-programmed. As the car RPM goes up so does the pulse width. However at regular intervals you have these spikes. They don't look like the spikes that would be indicative of a loose wire, because that would be very sharp and sudden... and random. These spikes look like my throttle function actually bringing the signal to a new target value and back again. Why is beyond me though. Sometimes the dips go down... in this case they go up. And while the intervals are not identical, they are fairly regular. I've also attached the vehicle scan occurring at the same time to show what the car is doing (untitled1 and 2, untitled 1 is the moment the boost fails and untitled 2 is when it's fully spooled up). I wanted to make it easier on myself so I kept the car in 6th for this segment because conditions can be held more constant over time, to rule out quickly changing input conditions.

I could talk all day about it but in the end I'm wondering if anyone can gleen something that I have missed. I've looked through the code over and over but I can't figure out what might be causing these blips. What I do know is it's a big problem. The current goes through the roof and risk burning out the ESC every time this happens, and it causes equally dramatic voltage drops. And with these spikes, the ESC is prone to fault before I can achieve higher levels of boost to keep up with the air demand at high RPMs. So until I fix this issue, there's no practical benefit to running this way, as the car never develops significant and reliable power, over running naturally aspirated.

Any insight on what might be wrong with the code would be greatly appreciated! Thanks!




sketch_mar24a_fast.ino (133.2 KB)

And just in case things weren't confusing enough, here's what it does in 2nd gear. Somewhere around 4000RPM, the signal starts to ramp down inexplicably.

I'll take a stab in the dark and say lack of filtering/shielding and a "rats nest" of wiring for the Arduino and it's associated components.
Automotive is a nasty noisy environment at the best of times let alone the addition of the above.

To protect your vehicle's electronics from electromagnetic interference (EMI), there are several strategies you can employ. EMI can cause malfunctions or degradation in performance if not properly mitigated. Here are some approaches you can consider:

1. Shielding

  • Shielded cables: Use cables with shielding (like braided metal or foil wraps) to reduce the amount of EMI they emit or pick up.
  • Enclosures: Place sensitive electronics in metal or conductive enclosures (Faraday cages) to block external electromagnetic fields.

2. Grounding

  • Proper grounding: Ensure that all electronic components and their enclosures are properly grounded to prevent stray electromagnetic signals from affecting them. Grounding can direct EMI away from sensitive components.

3. Ferrite Beads

  • Ferrite beads: Install ferrite beads on cables that run to and from sensitive electronics. These components help suppress high-frequency EMI by dissipating it as heat.

4. Twisted Pair Cables

  • Twisted pair wiring: If you're running wires, use twisted pair cables for signal lines. The twisting helps cancel out EMI that would otherwise be picked up by the wires.

5. Capacitors and Filters

  • EMI filters: Install EMI filters (low-pass, high-pass, or band-stop) on power supply lines or signal lines to prevent high-frequency noise from reaching sensitive electronics.
  • Capacitors: Capacitors between power lines and ground can help smooth out high-frequency noise.

6. Distance from EMI Sources

  • Separation: Keep sensitive electronics as far away as possible from sources of EMI, such as motors, ignitions, and power cables.

7. Proper Cable Routing

  • Avoid running signal cables near power lines, ignition systems, or any high-current cables to reduce the possibility of picking up interference.

8. Use EMI-Resistant Components

  • Whenever possible, use components that are specifically designed to be resistant to EMI, such as EMI-hardened sensors, controllers, and processors.

9. Suppress Noise at the Source

  • Suppress ignition noise: Use resistor-type spark plugs or ignition leads with built-in suppression to reduce EMI from the vehicle engine and ignition system.
  • DC-DC converters: For vehicles with electric systems, install noise-suppressed DC-DC converters to minimize EMI from power supplies.

why By implementing a combination of these techniques, you can significantly reduce the impact of EMI on your bike’s electronics. If you need help with a specific part or scenario, feel free to provide more details!

You did not state what type of vehicle you are looking at so here is a bit more information that may help:

Useful Resources for Automotive Electronics:

  1. STMicroelectronics Application Note AN2689:
    This application note provides guidelines on protecting automotive electronics from electrical hazards, focusing on design and component selection. Reading this will greatly enhance your understanding of automotive circuit protection.
    Read AN2689
  2. Analog Devices: Automotive Electronics Design:
    This article distills key insights into designing automotive electronics, offering practical advice for engineers.
    Read the article
  3. Diodes Incorporated: Transient Voltage Suppression in Automotive:
    Learn about techniques to protect automotive circuits from transient voltage, which is critical for ensuring reliable operation in harsh conditions.
    Read the article
  4. AEC-100 Standards Webinar:
    This webinar from Monolithic Power Systems provides a detailed overview of AEC standards, essential for understanding automotive electronics requirements.
    Watch the webinar
  5. Understanding Automotive Electronics, An Engineering Perspective by William B. Ribbens:
    This comprehensive book offers an in-depth look into automotive electronics from an engineering perspective, making it an invaluable resource.
    Access the book
  6. Application Note https://www.ti.com/lit/an/slvafc1/slvafc1.pdf?ts=1652591872294

This information was posted a while back, but I believe it will be helpful and save you time searching for it.

Hi, @Gahhhrrrlic

Can you post some images of your project?
So we can see your component layout.

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

I'm not saying it can't possibly be EMI but I really don't think it is. It looks like either a coding problem or something the ESC is doing. I'm using shielded Tefzel wires and everything is grounded properly. But the more damning evidence against noise is that RC signals are very specific... a 1500-2000 ms square wave. There's no way some noise would cause the organized and periodic 'ramp-up / ramp-down' behaviour evident in the ESC's log. If it were just noise, I'd expect the session to just fault out because the ESC wouldn't be discriminate signal from noise so it would lose sync and either freak out or give up.

TomGeorge:

The schematic is on a different computer so I'll try to grab a screenshot and post it. In the meantime, most of the other details you're requesting are described in detail in my videos. If you click on either of the 2 in the link in my OP, the other episodes will come up. 1 of them is just about the circuit board. Another demonstrates how the control box works.

It's worth re-iterating that the system hasn't always done this blip thing. Back when my biggest problem was a weak motor, it would run nice and smooth for the entire run... just never develop any boost. It's only since I got new batteries and one of these "Castle Link" chips to talk to the ESC that I started doing high power runs and seeing these anomalies. Naturally that points to the ESC but I've pretty much disabled all the 'features'. It's no longer doing any nanny shit and I can't explain why or how the ESC would artificially inflate the signal coming to it. That's why I suspect the code is doing it. But if I'm wrong and I were a betting man, I'd say it's 10x more likely the ESC than some wiring, grounding or EMI problem.

Tom here's the schematic you requested:

Anybody see anything in the code that would explain this?

Tuning in late, I will review the thread. Can you run the system with as much real hardware as possible removed?

The signals shouldn't care if the ESC and motor are attached, and so forth.

If it is software, you should still see the crappy signals.

a7

Hi, @Gahhhrrrlic
Thanks for the schematic.

Can you post some images of your project?
So we can see your component layout.

Thanks.. Tom.. :smiley: :+1: :coffee: :australia: