(SOLVED) Throttle Drops to Minimum Value As Soon As Arming (MAHOWIK BalancingWii with NRF24L01)

Hi All, I'm still attempting to build Mahowik Balancing Robot using Stepper Motor (nema 17) DRV8255 MPU6050, etc by modifying little changes to make it work with NRF24L01 (I turn into PWM not PPM Signal for TX and RX)

Everything LOOKS fine when controlling using NRF24L01 TX and able to arm it, but I've found a problem as shown below:

Throttle Value drops to minimum vlaue (1100) as soon as it was armed. In 1100 or 0 position of throttle it keeps showing drops and right motor increase into the highest value.

So, the left stepper motor goes forward and right stepper motor not spinning at all (even not jittering). I already checked the wiring and test it individually.

Here's the Schematic Summary:

(I powered Both MPU6050 and NRF24L01 using 3.3v of Arduino board (UNO) and has the same result when I use voltage regulator, e.g AMS1117 3.3v, etc - when checking using Multitester)

I integrated (injected) the Multiwii 2.3 of Mahowik's code modification for NRF24L01:

NRF24_RX.cpp: ================================================

#include "Arduino.h"
#include "config.h"
#include "def.h"
#include "types.h"
#include "BalancingWii.h"
#include "NRF24_RX.h"

#if defined(NRF24_RX)

int16_t nrf24_rcData[RC_CHANS];

const uint64_t pipe = 0xE8E8F0F0E1LL; //Must be the same as Transmitter
RF24 radio(10, 9);// CE, CSN

RF24Data strData;

void resetRF24Data(){
  strData.throttle = 0;
  strData.yaw = 128;
  strData.pitch = 128;
  strData.roll = 128;
  strData.AUX1 = 0;
  strData.AUX2 = 0;
}

void NRF24_Init() {
  resetRF24Data();
  radio.begin();
  radio.setDataRate(RF24_250KBPS);
  radio.setAutoAck(false);
  radio.openReadingPipe(1,pipe);
  radio.startListening();  
}

void NRF24_Read_RC() {
  static unsigned long lastRecvTime = 0;
  unsigned long now = millis();
  while (radio.available()) {
    radio.read(&strData, sizeof(RF24Data));
    lastRecvTime = now;
  }
  if (now - lastRecvTime > 1000) {
    resetRF24Data();
  }
  nrf24_rcData[THROTTLE]  = map(strData.throttle, 0, 255, 1000, 2000);
  nrf24_rcData[ROLL]      = map(strData.roll,     0, 255, 1000, 2000);
  nrf24_rcData[PITCH]     = map(strData.pitch,    0, 255, 1000, 2000);
  nrf24_rcData[YAW]       = map(strData.yaw,      0, 255, 1000, 2000);
  nrf24_rcData[AUX1]      = map(strData.AUX1,     0, 1,   1000, 2000);
  nrf24_rcData[AUX2]      = map(strData.AUX2,     0, 1,   1000, 2000);  
}


#endif

NRF24_RX.h ================================================

#ifndef NRF24_RX_H_
#define NRF24_RX_H_

#include "config.h"
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

#if defined(NRF24_RX)

// The sizeof this struct should not exceed 32 bytes
struct RF24Data {
  byte throttle;
  byte yaw;
  byte pitch;
  byte roll;
  byte AUX1;
  byte AUX2;
};
extern RF24Data nrf24Data;
extern int16_t nrf24_rcData[RC_CHANS];

void NRF24_Init();
void NRF24_Read_RC();

#endif

#endif /* NRF24_RX_H_ */

BESIDES, I also modified the code at: multiwii.cpp/balancingwii.cpp, def.h, config.h, protocol.cpp, RX.cpp to make NRF24L01 can be used in Mahowik BalancingWii. (TX RX Default is PPM)

Please help since I've been attempting to make this work for 3 months.

(Just a comment: I still use Arduino board for most of my projects. I'm not using esp8266, esp32, even STM32 so far since most of my projects shows powerful result and very very satisfied using arduino board. It depends who makes it).

For any real help you are going to need to post code or supply links to all code that is in both the transmitter and the receiver.

And a link to the plan you followed for using MultiWii for a balancing robot. Post the schematic diagrams you have been working from.

I see how MultiWii could serve from a theoretical point of view, but it's hard enough to get it to function satisfactorily with a quadcopter, a more common deployment vehicle. One usually relies on examining other successes and consulting with other users as to the many settings both in the source code and the configuration.

Which I am not saying you haven't done, rather that you might not have done enough of, or with an understanding of what you were doing.

You have the balance robot equivalent of a quad that flips over the minute you try to take off, or similar. It may just be a matter of the configuration and changing some values. Or you might have some part backwards out of the box.

You are in a corner of a niche. If you can share what you your sources have been for designing this as well as your source code, we will be better equipped to opinionate.

a7

Thank you sooo much for replying me. Yes, I did with DIY quadcopter with Multiwii 2.3 (using bluetooth, NRF24L01 and Flysky - which I uploaded the video in my YT Channel)

You're absolutely correct! I forgot something about FLIP BEHAVIOR !!! I would need time to check it back based on your clue! Thanks).

Here's the all code I modified from Mahowik BalancingWii to make it work with NRF24L01 (PWM not PPM).

Original AWESOME WORK of MAHOWIK.

OK, so not your first rodeo. I FF past the wasted time in you video and see you have already accomplished a traditional project. FWIW at a first glance I thought it was one of my quadcopters from my early days in the hobby. Fun!

I am quite sure I can't help, as sure I am of the feeling that you got this: there's just something you haven't done right yet!

Most of the ways ppl suggest to code and tune a quadcopter have direct equivalents for the balancing robot - I remember suspending my quadcopter and working on one axis at a time.

Say, do you fly with the accelerometer stabilisation? I haven't used that for some time, obvsly there is no rate mode (acro) possibility of rolling a balancing robot around. :expressionless:

a7

1 Like

Thanks, I really analyzed how my quadcopter works related to my problem and now it WORKS as expected, but there is a small problem HERE. It is just about HOW To make the robot stand alone using AUX2.

The solution of the problem above is to replace the DRV8255 motor driver. When I tested alone with single stepper motor, it actually had been damage :stuck_out_tongue: hehehe.

Thanks for marking the thread as solved. But it would be instructive for others if you told in detail how you determined the motor driver had been damaged.

1 Like

There are 3 KINDS of problem why the throttle drops to minimum (left motor) and maximum (right motor):

  1. Wrong pins order from DRV8255 pins to Arduino UNO pins

So, the problem is NOT because the MINTHROTTLE or MAXTHROTTLE configured in config.h and also NOT because the RX mapping value in NRF24_RX.cpp (integrated in BalancingWii code).

In this case, I use the default MINTHROTTLE and MAXTHROTTLE of Mahowik configuration:
MINTHROTTLE = 1100
MAXTHROTTLE = 1900

  1. You will find this code in BalancingWii.cpp:
  // apply both motor speed
    setMotorSpeed(0, outputSpeed + steering);    // right motor
    setMotorSpeed(1, -outputSpeed + steering);   // left motor

Then I changed into:

    setMotorSpeed(0, -outputSpeed + steering);   // Left motor
    setMotorSpeed(1,  outputSpeed + steering);   // Right motor

BONUS:
Actually, the right motor didn't spin AT ALL as soon as I armed. Then I tested with a single sample of spinning code to check if DRV8255 module is damaged. In fact, it spinned !!! but why when I integrated the module to Mahowik BalancingWii circuit, it really stopped, no jitters, no spinning and no life sympton. Lack of power supply? no! Mine is 12v 2A.

So, THIS IS NOT CAUSED BY BAD SOLDERING or BROKEN PATH OF the circuit - also NOT CAUSED BY POWER SUPPLY.

Here's the simple sketch to TEST IF DRV8255 I used:

#define DIR_PIN 6
#define STEP_PIN 5
#define ENABLE_PIN 4

void setup() {
  pinMode(DIR_PIN, OUTPUT);
  pinMode(STEP_PIN, OUTPUT);
  pinMode(ENABLE_PIN, OUTPUT);

  digitalWrite(ENABLE_PIN, LOW); // Enable the driver
  digitalWrite(DIR_PIN, HIGH);   // Choose direction
}

void loop() {
  digitalWrite(STEP_PIN, HIGH);
  delayMicroseconds(1000); // Adjust for speed
  digitalWrite(STEP_PIN, LOW);
  delayMicroseconds(1000);
}

When I replaced it using a NEW module and correct pins order, it works as expected!

HERE's the FINAL MAHOWIK BALANCINGWII with NRF24L01 full code including Transmitter code (ver1.1) - presented by Ardujimmy.

Original Mahowik BalancingWii: GitHub - mahowik/BalancingWii: Self balancing robot (Segway) based on modified/extended MultiWii 2.3 firmware.

NOTE:
I dont know, when first time working with Mahowik's BalancingWii code it didnt work. Found some errors and I must fix it and adjust it based on my circuit! (but, overall, THANKS to MAHOWIIK for Awesome Projects!!! Respect!)

NOW everyone can grab the code I fix and adjust it and modify it to be able to work with NRF24L01 in my Github repo FOR FREE.

Thanks to Paul_KD7HB and alto777 :face_blowing_a_kiss:

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