Arduino reboots endlessly

Hello everyone
Full code, works great on another arduino mega, but on Arduino where it is located on the board it loads, but restarts arduino infinitely, loaded the microcontroller, another code works if you delete a line from the code

ELEMYO MyoSensor1(CSpin1);  // create ELEMYO object to work with signal
ELEMYO MyoSensor2(CSpin2);  // create ELEMYO object to work with signal

Arduino stops rebooting, but the code won't work

Full code:

#include <ELEMYO.h>

#define CSpin1 10
#define CSpin2 9

#define sensorInPin1 A2  // analog input pin that the 1st sensor is attached to
#define sensorInPin2 A1  // analog input pin that the 2nd sensor is attached to

int signalReference = 524;  // reference of signal, 2.5 V for MYO, MYO-kit, BPM, BPM-kit
//int signalReference = 369;    // reference of signal, 1.8 V for MH-BPS101 and MH-BPS102

ELEMYO MyoSensor1(CSpin1);  // create ELEMYO object to work with signal
ELEMYO MyoSensor2(CSpin2);  // create ELEMYO object to work with signal

short tr1 = 100;  // trigger for 1st sensor
short tr2 = 100;  // trigger for 2nd sensor

int kizil = 13;
void setup() {
  Serial.begin(115200);          // initialize serial communications at 115200 bps
  MyoSensor1.gain(x4);           // initial value of gain for 1st sensor
  MyoSensor2.gain(x8);           // initial value of gain for 2nd sensor
  pinMode(sensorInPin1, INPUT);  // initialize sensorInPin
  pinMode(sensorInPin2, INPUT);  // initialize sensorInPin
  pinMode(kizil, OUTPUT);
}

//-------------!!! Calibrate gain for each sensor before start !!!---------------------------------------------------------------------------
void loop() {
  //----reading and filtering signal of 1st sensor----
  int signalValue1 = analogRead(sensorInPin1);                                   // read the analog in value:
  signalValue1 = MyoSensor1.BandStop(signalValue1, 50, 4);                       // notch 50 Hz filter with band window 4 Hz.
  signalValue1 = MyoSensor1.BandStop(signalValue1, 100, 6);                      // notch 100 Hz (one of 50 Hz mode) filter with band window 6 Hz
  signalValue1 = MyoSensor1.movingAverage(signalValue1, signalReference, 0.96);  // moving average transformation with 0.96 smoothing constant
  //--------------------------------------------

  //----reading and filtering signal of 2nd sensor----
  int signalValue2 = analogRead(sensorInPin2);                                   // read the analog in value:
  signalValue2 = MyoSensor2.BandStop(signalValue2, 50, 4);                       // notch 50 Hz filter with band window 4 Hz.
  signalValue2 = MyoSensor2.BandStop(signalValue2, 100, 6);                      // notch 100 Hz (one of 50 Hz mode) filter with band window 6 Hz
  signalValue2 = MyoSensor2.movingAverage(signalValue2, signalReference, 0.96);  // moving average transformation with 0.96 smoothing constant
  //--------------------------------------------
  Serial.println(signalValue1);
  if (signalValue1 > 130) {

    digitalWrite(kizil, HIGH);
  } else {

    digitalWrite(kizil, LOW);
  }
}

How are these servos being powered. If it is only from the 5V line it looks like you are drawing too much current from the Arduino.

Try just driving one and see what happens.

We need to see your schematic, for a more accurate diagnosis.

1 Like

Thanks.
What are these DRV8833 devices, do you have a link to them?

As I said before it looks like your USB is the only source of power. Normally you would power a servo with an external power source, say a 5V battery charger. Connect the +5 to your servos and the ground (negative pin) of your charger to the Arduino ground.

1 Like

DRV8833:

I feed the project from two lithium polymer battery and lower it to 5V 4A with this: https://aliexpress.ru/item/4001313603033.html?spm=a2g2w.favourites.mywishlist.110.12dd4aa6IRZ4pX&sku_id=10000015755821505

Bit hard to read that so look at

Click on the "Read More", then you can down load the data sheet for the chip.

This chip needs a lot more current than a USB connection can supply.

1 Like

I have power from 2 polymer batteries, I made a power supply with 5.3 volts 4 amps with the help of a lowering module, The project is powered by it, not by a usb connection

If you mean connecting to the microcontroller and the power driver, it is marked j3(power), but I should have said it again in writing, sorry

There are also N20 encoder motors and that's it

It's Halloween, so maybe we should expect spooky things, but @Grumpy_Mike how did you know there would be servos? @muhammedjan did not mention them. We only saw motor drivers in the following post, and those are not for servos...

1 Like

Yes, no servo drives, instead of N20 encoder motors

Well a combination of just having answered a question about servos, and by my crystal ball going on the blink at the wrong time.

So want to post a link to these N20 encoder motors? Hopefully on a site we can read without a language degree.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.