Monster Moto Shield VNH2SP30 PWM Problem

Hello all,

I have set up an Arduino Uno with Sparkfun Monster Moto shield I’ve linked below, along with the instructable article I am basing this project off of. The goal is an independent heated bed for 3D Printing controlled by the Uno and shield.

I am using the code referenced in the article and everything is working great. I can see an accurate temperature reading in the serial monitor and the PWM going up as soon as I turn the main power supply on. Once the plate hits the preset temp, the PWM falls to zero and the plate shuts off. Here’s the problem:

Once the plate goes below the set temp, the PWM starts to rise again to max, but the moto drive directional light doesn’t come on and no power goes to the plate. The only way to get the plate to heat up is to power cycle the external power supply. As far as I am aware, all of my relevant pins have been soldered and everything is physically hooked up correctly. I have attached the code I am using as well as links to the plate and Moto chip.

I should add I have two toggle switches connected to the pins mentioned in the code for the start pin and temp pin.

Please let me know if I can provide any more information.

Moto Chip- https://www.amazon.com/gp/product/B07QSVD4X7/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1

Plate-

Thanks for reading!

J

heatbed4.ino (5.94 KB)

You will get more responses if you post your code inline instead of in an attachment.

  while (digitalRead(startPin) == HIGH  )[/quote]

There's two problems with this. First, you already read this pin at the top of loop(). If you read it again, you might get a different answer.

Second, and more seriously, the while() makes this whole function a blocking function. That's why you're forced to read the switches again here. Read all the inputs at the top of loop() and then use those inputs in non-blocking functions which return to loop() in microseconds or milliseconds.

heatbedOff(int motor) actually switches off both "motors" but only changes the PWM on one of them.

The big while() loop takes 150ms to run. (5*10ms unnecessary delays for reading the thermistor and 100ms for slowing down the Serial printing to a reasonable speed. At the most, it can adjust pwm by one step in that time. So it will take about 38 seconds to ramp down to zero after the temperature crosses the threshold. That seems like a lot for a print bed heater.

I'm not seeing anything obvious why it would appear to switch off permanently after reaching the target.

@Thatguyatbreakfast

Other post/duplicate DELETED Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Please READ THIS POST to help you get the best out of the forum.

Bob.