Microcontroller is screaming

Sometimes, when our robot is turned on but the motors aren’t spinning, the microcontroller makes this high-pitched whine I refer to as “screaming”. It only happens sometimes and does not seem to correlated with any other things the robot does.

Is this supposed to happen, or is something wrong?

Are you sure its coming from the microcontroller? If a motor is ever so slightly powered (but not enough to move) then it makes a high pitched whine. It often can happen on the drive if the joystick doesn’t have a deadzone. Try moving the joysticks ever so slightly, it should change the pitch of the whine.

Yeah that shouldn’t be happening.

I have a robot and sometimes it screams.
I look at it and I turned it off and about 30 minutes to 1 hour of charging and waiting it started to work again.
But if it does not work ask me ok. :wink:

It tends to happen when I lean on the joystick or when the motor values are very small numbers such as one or 2. They’ll scream in an attempt to spin but just double check your code and make sure you aren’t pressing anything. Post your code here and we can double check it for you.

You can also recalibrate your joystick to reset the zero point.


Deadband in the code to set motors to 0 and proper joystick calibration seem to work best. Within 10 or 15 on the joystick is generally a deadband I have seen.

Okay, honestly, I’m not sure if it’s the microcontroller or the motor. On our robot, they’re pretty close together. I have heard it on the motor before, but the microcontroller seemed to be a more likely source this time around (unless my ears are worse than I thought). But with the information available, it’s probably the motors.

Are the motors supposed to do that?

Yeah, when motors are run at low powers, they are supposed to. Not sure if it’s intentional, but it gives a good indication if your motors are running.

When you unplug the motors does it still make the noise?

The noise is, as previously mentioned, due to motors operating at a low power value. The motor making this noise is likely one being controlled by a joystick. The joystick could be slightly dislodged, forwards or backwards, making it run the motors ever so slightly. Thus, the motors are running at low power, causing them to whine.

The Cortex will emit a high pitched whine if there is a potential short circuit or something like that. I know this because I first discovered it when I made an electromagnet and plugged it into a motor controller and then into the Cortex. It worked brilliantly, but the Cortex emitted a horrible sound, which I figured was not good, so I stopped :slight_smile: .

It is most definitely because since the joysticks have a wide range of values, they are almost never centered at the 0,0 position. This is causing the motor to be fed a very slight power, and if you notice this happens with all motors such as drills when they dont have enough torque to move the object/wheel/screw. There is a nice way to fix it though and this is called joystick thresholds and basically says if motor is under threshold then it doesent move else motor goes at the power. Good luck