Go Down

Topic: Don't know where to start (Read 742 times) previous topic - next topic

CodeCruncher

I have done FPV with model cars , it is not easy and requires both hands.
Now if you steer with your knees you can hold a beer in both hands. :)
Also less risk of the mower coming towards your feet when having one too many or falling asleep.

Automating it with an electrical fence would probably be a more practical approach.
I was wondering if I could do something like a Roomba using the fence and sensors to keep from colliding but that is really putting the cart before the horse, first things first and I need to get basic remote code working first. 

Boardburner2

#16
Mar 20, 2017, 12:05 pm Last Edit: Mar 20, 2017, 12:09 pm by Boardburner2
A relative used to have a robot mower.
A perimeter wire is placed on the grass to act as a fence unlike a roomba that just bumps against the walls.

Remote controlling a vehicle with a camera is actually very difficult and requires much more skill than for instance controlling a model plane by observing from a distance.

A camera has a narrow field of view and does not have the peripheral vision that the human eye has and also lacks depth information, no stereoscopic vision.

CodeCruncher

A relative used to have a robot mower.
A perimeter wire is placed on the grass to act as a fence unlike a roomba that just bumps against the walls.

Remote controlling a vehicle with a camera is actually very difficult and requires much more skill than for instance controlling a model plane by observing from a distance.

A camera has a narrow field of view and does not have the peripheral vision that the human eye has and also lacks depth information, no stereoscopic vision.
That's why the invented FPV goggles... A friend of mine in the UK is big into FPV helicopters and planes. It is big dollars to do 3D properly but the option is there for down the track. For now I just bought 8 cheap proximity sensors from HobbyKing I want to configure that it slows down when it gets close to objects. So even if I don't pick it up visually, the sensors on the mower should detect object and slow accordingly.
I plan to do this in stages, stage one is just get the remote control mower going, I don't need the Arduino for that, as the receiver can be plugged directly into motor controller, but as time goes by I want to add more and more magic to the Arduino to give it more smarts. First step is to get basic movement.
Last night I did a quick wire up to bind the receiver to the transmitter and load the basic sketch from here https://www.sparkfun.com/tutorials/348 using the serial monitor I could observe the output of the first three channels. The second and third channel seem to be connected to the same direction control, but that isn't a major issue since I wont need all the channels.
RH Up/Down - Left/Right Control (Channel 1 = left 1030/31, centre 1442/43, right 1845/46)
RH Up/Down - Left/Right Control (Channel 2 = down 1031/32, centre 1439/46, up 1846/53)
RH Up/Down - Left/Right Control (Channel 3 = down 0, centre 0, up 1444/51)

So now I need to finesse the basic code a bit and I should be underway.

CodeCruncher

So don't use the Turnigy stuff. The nRF24L01+ modules are only about £2 each.

...R
To be perfectly honest I couldn't quite make out what these modules were meant to do. Are the individual receivers? I got some code working last night on the Turnigy receiver.

Boardburner2

#19
Mar 21, 2017, 08:48 am Last Edit: Mar 21, 2017, 08:59 am by Boardburner2
3d  FPV.

Do not know anyone with that yet.
The choice between putting the children through university and cutting the lawn is a tough one.  :)
But if you come up with a sport version of your lawnmower i know a couple of guys that would buy one.

Robin2

To be perfectly honest I couldn't quite make out what these modules were meant to do.
The nRF24L01+ modules are 2.4GHz transceivers. They can reliably send packets of up to 32 bytes of data from one to the other (in either direction).

I am assuming the Turnigy device is a regular RC transmitter that sends a train of servo pulses which the Arduino would have to measure to figure out the servo position. Sending data avoids that measuring and allows much greater flexibility in the nature of the information transmitted.

The nRF24L01+ will also allow the "receiver" to send back data because it is a 2-way system.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

CodeCruncher

The nRF24L01+ modules are 2.4GHz transceivers. They can reliably send packets of up to 32 bytes of data from one to the other (in either direction).

I am assuming the Turnigy device is a regular RC transmitter that sends a train of servo pulses which the Arduino would have to measure to figure out the servo position. Sending data avoids that measuring and allows much greater flexibility in the nature of the information transmitted.

The nRF24L01+ will also allow the "receiver" to send back data because it is a 2-way system.

...R
I think the reason why most people use a typical RC transmitter for this kind of project is ease of control. Forward / Backwards / Left / Right can be done with as little as one physical control, or two depending on what you want. I also want to be able to cut power to the motor and engine remotely so the inbuilt switches come in handy for that.
I have been modifying a bit of simple code to workout how to perform the basic functions I need. So far I have some usable readings on the serial monitor.
I would have liked to use a Switch Case, to make it tidier, but it appears C only knows how to deal with constants and not comparision operators like VB.
Code: [Select]

int ch1; // Here's where we'll keep our channel values
int ch2;
int ch5;

void setup() {

pinMode(2, INPUT); // Set our input pins as such
pinMode(3, INPUT);
pinMode(4, INPUT);
Serial.begin(9600); // Begin the serial stream

}

void loop() {
 
  ch1 = pulseIn(2, HIGH, 25000); // Read the pulse width of each channel
  ch2 = pulseIn(3, HIGH, 25000);
  ch5 = pulseIn(4, HIGH, 25000);

  Serial.print("Channel 1: "); // Print the value of each channel
  Serial.print(ch1);
  if (ch1 > 1000 && ch1 < 1436){Serial.print(" Left");}
  else if (ch1 >= 1436 && ch1 <= 1447){Serial.print(" Neutral");}
  else if (ch1 > 1447 && ch1 < 2000){Serial.print(" Right");}
  else {Serial.print(" - ");}

  Serial.print(" Channel 2: ");
  Serial.print(ch2);
  if (ch2 > 1000 && ch2 < 1436){Serial.print(" Reverse");}
  else if (ch2 >= 1436 && ch2 <= 1448){Serial.print(" Neutral");}
  else if (ch2 > 1448 && ch2 < 2000){Serial.print(" Forward");}
  else {Serial.print(" - ");}

  Serial.print(" Channel 5: ");
  Serial.print(ch5);
  if (ch5 > 1100){Serial.print(" Power On");}
  else {Serial.print(" *** Power Off ***");}

  {Serial.println(" - End");}
  delay(1000);// I put this here just to make the terminal window happier
 
}

/*
 RC PulseIn Joystick
 By: Nick Poole
 SparkFun Electronics
 Date: 5
 License: CC-BY SA 3.0 - Creative commons share-alike 3.0
 use this code however you'd like, just keep this license and
 attribute. Let me know if you make hugely, awesome, great changes.
 */

wildbill

Take a look at the case ranges gcc supports:

Code: [Select]

case 1001 ... 1435:
 

CodeCruncher

Take a look at the case ranges gcc supports:

Code: [Select]

case 1001 ... 1435:
 


I took a quick look at that and it seemed similar to a VB.Net "To" i.e Case 1001 To 1435:
Sometimes the operators can get quite complex, so I opted for the IF routine even though I don't think it is as visually appealing. I guess for this particular bit of code I could have used that to achieve the desired result.

Robin2

#24
Mar 21, 2017, 05:44 pm Last Edit: Mar 21, 2017, 05:46 pm by Robin2
I think the reason why most people use a typical RC transmitter for this kind of project is ease of control. Forward / Backwards / Left / Right can be done with as little as one physical control, or two depending on what you want. I also want to be able to cut power to the motor and engine remotely so the inbuilt switches come in handy for that.
I think you are confusing the physical control system on an RC transmitter with the wireless transmission system. They are quite separate things.

It would not be difficult to use an Arduino to collect data from the joysticks and switches and send it to another Arduino using nRF24 transceivers.

The difference is that it would be sending numbers that can be interpreted directly and which can be verified with check-sums rather than a pulse width that has to be measured by the receiver - which might measure it incorrectly.


Just my 3 cents.

...R
PS. I strongly suspect that the Turnigy system is using transceivers like the nRF24 (if not identical) and sending numbers and it is the receiver that is converting all that accurate data into less precise pulse widths for use by servos.
Two or three hours spent thinking and reading documentation solves most programming problems.

CodeCruncher

#25
Mar 22, 2017, 12:36 am Last Edit: Mar 22, 2017, 12:43 am by CodeCruncher
PS. I strongly suspect that the Turnigy system is using transceivers like the nRF24 (if not identical) and sending numbers and it is the receiver that is converting all that accurate data into less precise pulse widths for use by servos.
I am still trying to work out how accurate the data being sent needs to be. Considering I am not using ultra precise planes or helicopters with this remote, it may not be super important if I have a small amount of what I would call jitter.

This is the remote I am using. Which says it has an Encoder type: ppm/pcm I am currently using ppm to give me a variable readout of between ~1030 and 1840, I really don't know the difference between them but this protocols page helps. Leaving the remote physical controls stationary I might get a roughly 10 number variation at the middle position of ~1440, which I can easily remove by creating a deadband that says anything in between those numbers is neutral or center.


That give me roughly 400 number to achieve 0-100% in the forward direction and the same in reverse, so 5 numbers each way roughly translates to a 1% error. Certainly not a deal breaker on a mower.

This old video is of my friends remote mower using the exact same 9x remote and Sabertooth motor controller, except he hasn't used the Arduino in between them like I plan to.




CodeCruncher

#26
Mar 22, 2017, 01:26 am Last Edit: Mar 22, 2017, 01:39 am by CodeCruncher
Seems I was trying to reinvent the wheel and have hit the motherload... Sabertooth Arduino libraries and examples

N.B. If anyone down the track is trying to do the same thing as I am, download the exe file and install. It installs the libraries and examples straight into the Arduino.exe program :D

GoodGuyQ

If you just want to RC it; get something like Spektrum AR9020 with a dxi controller from eBay. With the Sabertooth, to just drive it back and forth, you just need Sabertooth and that spektrum. Mine is working right now. No arduino needed.

NOW I am trying to wifi it and add cam. But not sure where to start. Think I will just get the pi zero w.

My 2x32 will ramp.

vinceherman

If you insist on using the Turnigy devices then please post a link to the receiver datasheet or user manual.
The part that is relevant is that it is an 8 channel RC hobby receiver that drives 8 servo signals.


Robin2

The part that is relevant is that it is an 8 channel RC hobby receiver that drives 8 servo signals.
With Arduinos and an nRF24 you could drive more - an Uno can manage 12.  And an nRF24 can send data (in both directions) that has nothing to do with servos.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up