Wireless dc speed controller with feed back

I plan to make a wireless dc speed controller which will allow you to set the required rpm and then read the actual rpm on a remote.

The server is a uno connected to the dc motor via an esc (https://www.motiondynamics.com.au/12v-48v-dc-speed-control-single-direction-25a-pcb-model.html) reads the rpm of the motor via a Slot Type IR Optocoupler Speed Sensor Module LM393 and then adjusts the pwm out to the esc until it achieves the required rpm from the client.

The client consists of a uno with a dfrobot lcd button shield.

The server transmits the actual rpm to the client.

The client transmits the required rpm and the start/stop status to the server.

The radios are nrf24L01, low power versions.

This will be used to control an implement from the cab of a tractor.
The idea is the operator can set the required rpm from the cab of the tractor, hit start, and the server will then make adjustments to the esc to maintain the required rpm under variable conditions. If the required rpm is unable to be maintained, a piezo buzzer will sound a warning to the operator that there may be a fault, ie a jam or mechanical failure.

Are the radios likely to operate effectively in that type of environment?

I am a noob and have been reading Planning and Implementing an Arduino Program by Robin2 and have started some sketches but I am going to need a hand to get this thing working.
Is there anyone willing to comment on what I am trying to do and perhaps mentor me through this?Sketches are as follows.

Server

#include <RHReliableDatagram.h>
#include <RH_NRF24.h>
#include <SPI.h>

#define CLIENT_ADDRESS 1
#define SERVER_ADDRESS 2

// Singleton instance of the radio driver
RH_NRF24 driver;
// RH_NRF24 driver(8, 7);   // For RFM73 on Anarduino Mini

// Class to manage message delivery and receipt, using the driver declared above
RHReliableDatagram manager(driver, SERVER_ADDRESS);

void setup() {
  Serial.begin(9600);
  if (!manager.init())
    Serial.println("init failed");
  // Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm

}

void loop() {
  listenForClient();
  getRequiredRpm();
  getStartStop();
  switchOnOff();//Set relay open or closed to activate/deactivate esc.
  readRpm();//Read optosensor and adjust for Rpm
  adjustEsc();//Adjust Rpm to achieve required Rpm
  sendRpmtoClient();

}

void listenForClient(){
  
}

void getRequiredRpm(){
  
}

void getStartStop(){
  
}

void switchOnOff(){
  
}

void readRpm(){
  
}

void adjustEsc(){
  
}

void sendRpmtoClient(){
  
}

Client

#include <LiquidCrystal.h>

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

// define some values used by the panel and buttons

int lcd_key     = 0;
int adc_key_in  = 0;

#define btnRIGHT  0
#define btnUP     1
#define btnDOWN   2
#define btnLEFT   3
#define btnSELECT 4
#define btnNONE   5

int read_LCD_buttons() {              // read the buttons
  adc_key_in = analogRead(0);       // read the value from the sensor

  if (adc_key_in > 1000) return btnNONE;

  if (adc_key_in < 50)   return btnRIGHT;
  if (adc_key_in < 195)  return btnUP;
  if (adc_key_in < 380)  return btnDOWN;
  if (adc_key_in < 555)  return btnLEFT;
  if (adc_key_in < 790)  return btnSELECT;

  return btnNONE;                // when all others fail, return this.

#include <RHReliableDatagram.h>
#include <RH_NRF24.h>
#include <SPI.h>

#define CLIENT_ADDRESS 1
#define SERVER_ADDRESS 2

  // Singleton instance of the radio driver
  RH_NRF24 driver;
  // RH_NRF24 driver(8, 7);   // For RFM73 on Anarduino Mini

  // Class to manage message delivery and receipt, using the driver declared above
  RHReliableDatagram manager(driver, CLIENT_ADDRESS);


  void setup() {

    lcd.begin(16, 2);
    lcd.setCursor(3, 0);
    lcd.print("Lava Valley");
    lcd.setCursor(5, 1);
    lcd.print("Produce");
    delay(3000);
    lcd.clear();
    lcd.print("Seedr Controller");
    lcd.setCursor(1, 1);
    lcd.print("by Chris Dalby");
    delay(5000);
    lcd.clear();
    lcd.print("Set RPM");
    Serial.begin(9600);
    if (!manager.init())
      Serial.println("init failed");
    // Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm

  }

  void loop() {
    listenForServer();
    displayRpm();
    readButtons();
    adjRequiredRpm();
    displayRequiredRpm();
    setStartStop();
    sendDatatoServer();//Send RequiredRpm & Start/Stop to Server.

  }

  void listenForServer(){

  }

  void displayRpm(){

  }

  void readButtons(){

  }

  void adjRequiredRpm(){

  }

  void displayRequiredRpm(){

  }

  void setStartStop(){

  }

  void sendDatatoServer(){

  }

Radio waves are like sound waves, in that they bounce off of some things, and are absorbed by other things. If you are in a poorly designed acoustic environment, a speaker's words may be hard to understand, because you are getting echoes along with your signal. Of course, you can have an obstacle between you and the sound source, so then you only get echoes. And echoes can interfere, or reinforce, depending on path lengths.

How does this apply to your project? Well, it sounds like you will be using these radios in a variable environment, with big objects moving around, objects that might be dangerous. Predicting radio performance in that environment is a bit foolish. I suggest you set up a few test platforms with your radios, send test signals, and log the success rate. Get plenty of data, and run every possible scenario. If your success rate isn't really high, you could try going to a more conservative protocol, like multiple tries per message, or strong error correction. Good antennas would also improve things. But if your controlling moving equipment, time might be critical, so too much repetition after missed messages might be dangerous.

An increase in tx power or a decrease in frequency also will improve the odds of good transmission. I'd suggest looking at 433 MHz. receivers. The RFM-22B is my favorite. easy to use (with theRadioHead library), and capable of 0.1 watt, with good antennas. It would be a good starter for your tests.

I agree with @jrdoner about the risk of wireless interference but you may be able to locate nRF24s in a suitable position.

I don't have experience with lower frequency wireless devices.

I got my nRF24s working with this Tutorial

I suggest you use the TMRh20 version of the RF24 library - it solves some problems from the ManiacBug version

The pair of programs in this link may be do most of what you require.

...R

Thanks for the responses.

I get the concern about the reliability of the signal. The motor control is not something that could potentially cause a danger to anyone if it became uncontrollable, although it would cost money it terms of wasted product.
I feel like it's worth a try with the nrf24L01's initially.

I have seen this tutorial before but I have already started using the radiohead library. Is there any advantage in using the Tmrh20 version over the radiohead version?

The 433Mhz transceivers look cool. I'll get a pair to play with.

You can add an emergency brake, that stops the car when nothing is received for some time. The remote control can send an idle message every second, to verify that the connection is not broken.

moose4621:
Is there any advantage in using the Tmrh20 version over the radiohead version?

I have not tried the radiohead library. The example code I posted a link to uses the TMRh20 library.

...R