Category Archives: Projects

Projects at Sailability Gold Coast.

TReX motor Driver for Disabled power assist

This Article will hold information relating to driving winches in the Access Dinghies with a Pololu TReX motor Driver.

IMG_20151231_121929The TRex from Pololu can drive three motors
Two Bidirectional – ie , forward and reverse ,or attached to main sheet winch, Main in, Main out.
One Single direction but with adjustable speed – suitable for bilge pump or signaling device (LED, HORN)

Brief Update

We found that the Arduino (tho a good idea) was not necessary and added unneeded complexity.
– The Pololu TReX motor driver is connected directly to the winches and the joystick to the TReX.
– Joystick's, originally from Servo City in USA cost quite a lot in postage..$50 from memory…

They are also available via ebay, just search 'potentiometer Joystick' for about $25 inc postage.

I will get a photo of it fitted to one of the Liberty Dinghies and post it up.

– Setting of 28/30 for the winches (with the TReX software from Pololu) gives max pulling power on the sheets with out breaking anything.

Postage from USA is quite expensive but here is a link to Pololu which has all of the documentation, its quite extensive and there is also an Arduino Sketch there i did up for this Motor Controller (gcebiker is my web name)…..the documentation on the Arduino sketch needs tweaking as i found their math for the settings to not quite add up (but its a very good starting point), 28/30 works for us but we are also using a modified 'electric window winder motor' from a car to drive the Jib Winch after the original was over driven.

I now get the Pololu Parts and many of my other parts from Little Bird Electronics in Australia.

Pololu TReX Dual Motor Controller DMC01

Older pages than this i have on this site also list other drivers we trialed.

This Driver was also covered in liquid Tape to delay corrosion, the clear top is necessary to see the LED indicators on the board for trouble shooting/seeing if it has armed itself.


 

 

 

Wiring

Arduino

Joystick to A0 and A1
Switch for pump/horn D4 – and ground if using independent (of joystick) switch.
Digital Pin 8 (TX in this sketch) to TRex 'SI' (Serial Input)
Digital Pin 7(RX in this sketch) to TReX 'SO' (Serial Output)
Ground Arduino to TReX ground Serial pin Headers
+ 5v to TReX BEC (battery eliminator)

 

Below are pictures as it is assembled, tight fit may need a bigger water proof enclosure.

IMG_20151230_144749IMG_20151230_144958 IMG_20151230_144800 IMG_20151230_144819 IMG_20151230_144834 IMG_20151230_144845 IMG_20151230_144909 IMG_20151231_121942 

 

 

TReX
As per diagram below from Pololu Website.

0J294.1200

 

0J290.1200

 

0J95.1200

Copy of Current Arduino Code, Revisions may not be up to date as code is changing quite quickly as i am building it.

/* written by Tony Matthews for the purpose of
Disabled assist sail winch control
in 303 and liberty Class Access dinghy's

One brushed bidirectional motor drives a main sheet winch,
One brushed bidirectional motor drives a jib sheet (liberty) or rudder (303's, 2.3's)
One brushed motor is a bilge pump, to empty any water that splashes in
Or operate signaling device, horn/light.

Code here in is written by Tony Matthews, whom has TBI.
TBI – Traumatic Brain Injury …Use at your own risk.
For the benefit of Sailability Gold Coast, Queensland, Australia.

Serial.print is for testing.
tRexSerial.write is the software serial UART to communicate with the TReX.


Notes from Pololu's documentation.
–Motor Current codes —
Code needs one of each ie, current and current limit
0x13: motor 1 current limit (default: 0 – no motor 1 current limit)
0x14: motor 2 current limit (default: 0 – no motor 2 current limit)
0x15: motor 1 current limit proportionality constant P (default: 0x0A)
0x16: motor 2 current limit proportionality constant P (default: 0x0A)

–Acceleration Codes–
Acceleration used over 'set direction' as TReX has in built soft start/stop
Less wear on the winches to have soft starts.
Motor 1 – BiDirectional
0xC4 – Brake Low M1
0xC5 – Reverse M1
0xC6 – Forward M1
0xC7 – Brake low M1

Motor 2 – BiDirectional
0xCC – Brake Low M2
0xCD – Reverse M2
0xCE – Forward M2
0xCF – Brake Low M2

Motor 3 – Single direction only
0xF1 – Accelerate Motor M3

— Motor speed settings —
May be represented as an integer as the Arduino converts it to HEX automatically (TReX reads HEX)
Must be positive number between 0-127
0 being stopped, 127 full speed
(Actual speed depends on acceleration logic and current draw V current limit)
eg M3 to full speed would be
tRexSerial.write(0xF1);  //M3
tRexSerial.write(127);  // full speed

All motor speed/direction/stopped need a speed value to go with them , eg stopped + 0 , forward + 127
*/


//Software serial settings
#include <SoftwareSerial.h>
const int rx = 7; // rx pin of Arduino, SO(serial out)of TRex.
const int tx = 8; // tx pin of Arduino, SI(serial in)of TRex.

SoftwareSerial tRexSerial (rx, tx); // RX to SO of Trex, TX to SI of Trex

// Pot inputs
// Main sheet M1
int mainPin = A0;  //input A0 for mainsheet
int mainVal = 511;  // int to hold main Input value,  start up in neutral 511
int mainValmapin;
int mainValmapout;

// Jib sheet M2
int jibPin = A1;
int jibVal = 511;
int jibValmapin;
int jibValmapout;


// dead band settings
int deadVal = 300;    // will change to pot values , one for each axis
int midVal = 511;
int fwdVal = (midVal + deadVal);
int revVal = (midVal – deadVal);

int zero = 0;    // integer for serial data '0' as 0 is ambiguous as used in a 'serial.write(0)'

// Power/speed variables
// Current limit (desired current limit in milliamp's / 150ma / 2 = ( )value)
// (rounded up) 2amps=7 , 10amps=33
int maxAmps = 2;//Current limit (desired current limit in milliamp's / 150ma / 2 = ( )value)
int overAmpbeh = 0; // over Amp limit behaviour 0=turn motor off
// data packet settings
unsigned char data[4];
unsigned long timer = 0;

void setup()
{
  delay (1000);
  tRexSerial.begin(19200);
  delay (400) ;    // wait for serial to start.

  // Write TReX Motor Settings/Behavior.


  // build M1 data packet for current limit and proportionally constant
  // build M1 current limit packet
  {
    data[0] = (0x80);   // set parameter bit instruction
    data[1] = (0x07);   // TReX id number (if i had more than one, still necessary with only one)
    data[2] = (0x13);   // Parameter id, 0x13 for M1 Current Limit
    data[3] = (maxAmps);     // Current limit (desired current limit in milliamps / 150ma / 2 = ( )value)
    // eg, desired current limit 2amps, ergo 2000/150/2=6.66, rounded up to 7
    for (unsigned char i = 0; i < 4; i++)
      tRexSerial.write(data[i]);
  }
  delay(10);
  // build M1 Proportionally constant settings packet
  {
    data[0] = (0x80);   // set parameter bit instruction
    data[1] = (0x07);   // TReX id number (if i had more than one, still necessary with only one)
    data[2] = (0x15);   // Parameter id, 0x15 for M1 Proportionally constant current Limit (pccl)
    data[3] = (overAmpbeh);      // Behavior of PCCL current limit // Proportionally constant 0 (turn motors off if over current)

    for (unsigned char i = 0; i < 4; i++)
      tRexSerial.write(data[i]);
  }
  delay(10);
  //Build M2 Parameter settings packets

  //M2 data packet for current limit
  {
    data[0] = (0x80);   // set parameter bit instruction
    data[1] = (0x07);   // TReX id number (if i had more than one, still necessary with only one)
    data[2] = (0x14);   // Parameter id, 0x14 for M2 Current Limit
    data[3] = (maxAmps);      // Current limit (desired current limit in milliamps / 150ma / 2 = ( )value)
    // eg, desired current limit 2amps, ergo 2000/150/2=6.66, rounded up to 7
    for (unsigned char i = 0; i < 4; i++)
      tRexSerial.write(data[i]);
  }
  delay(10);
  // Build M2 Proportionally constant settings packet
  {
    data[0] = (0x80);   // set parameter bit instruction
    data[1] = (0x07);   // TReX id number (if i had more than one, still necessary with only one)
    data[2] = (0x16);   // Parameter id, 0x15 for M1 Proportionally constant current Limit
    data[3] = (overAmpbeh);      // Behavior of PCCL  Proportionally constant 0 (turn motors off if over current)

    for (unsigned char i = 0; i < 4; i++)
      tRexSerial.write(data[i]);
  }
  delay (10); // give tRex time to apply settings.

}
void loop () {
  // Main sheet control (M1)
  {
    mainVal = analogRead(mainPin);
    delay(10);

    if (mainVal > fwdVal)   // Forward M1
    {
      mainValmapout = map(mainVal, fwdVal, 1023, 0 , 127); // map speed to return int 0-127
      data [0] = (0xC6); // accelerate motor 1
      data [1] = (mainValmapout);   // Analog read val ,mapped.
      for (unsigned char i = 0; i < 2; i++)
        tRexSerial.write(data[i]);
    }
    else if (mainVal < revVal )  // Reverse M1
    {
      mainValmapin = map(mainVal, 0, revVal, 127 , 0); // map reverse speed to return int 0-127
      data [0] = (0xC5); //reverse accelerate motor 1
      data [1] = (mainValmapin); // Analog read val ,mapped.
      for (unsigned char i = 0; i < 4; i++)
        tRexSerial.write(data[i]);
    }
    else       // stop M1
      tRexSerial.write(0xC7);   // brake low
    tRexSerial.write(zero);   // zero integer value
  }

  //Jib sheet control (M2)
  {
    jibVal = analogRead(jibPin);
    delay(10);

    if (jibVal >= fwdVal)    // Forward M2
    {
      jibValmapout = map(jibVal, fwdVal, 1023, 0, 127); // map speed to return positive int 0-127
      data [0] = (0xCE); // accelerate motor 2 forward
      data [1] = (jibValmapout); // Analog read val, mapped.
      for (unsigned char i = 0; i < 2; i++)
        tRexSerial.write(data[i]);
    }

    else if (jibVal <= revVal )    // Reverse M2
    {
      jibValmapin = map(jibVal, 0, revVal, 127 , 0); // map reverse speed to return positive int 0-127
      data [0] = (0xCD); //reverse accelerate motor 2
      data [1] = (jibValmapin); // Analog read val ,mapped.
      for (unsigned char i = 0; i < 2; i++)
        tRexSerial.write(data[i]);
    }

    else   // brake M2
      tRexSerial.write(0xCF); // brake low
    tRexSerial.write(zero); // zero integer value

  }

}

 

 

Liberty Proportional Winch assist

This page shall hold the information relating to the ongoing upgrade to the liberty electric assist module controller.

 

Presently ,

The Liberty's electric assist controller is only ON/OFF, controlled by micro switches.
This does not allow for minor adjustments of the sail (smaller than a person might operate the micro switch)

Trials underway for Proportional Control, that is – minor movement of joystick, means slow speed of motor winch for fine control of sheets. Full throw of the joystick giving a programmable max motor speed up to 100%

 

Present test bed,
– Wheelchair Joystick with potentiometer's giving analog input to micro computer (Arduino Nano V3.0)
– Out put from micro computer to (2) two Brushed, RC car ESC's
(not going to work due to voltage limitations of the ESC's)

Going to try the L298N Motor Driver, the Preslite motors (in the Liberty Winches) are supposed to only draw 2amp (Kevin G and I are highly dubious of this)

$10 + freight, Purchased from – http://littlebirdelectronics.com.au/products/l298-dual-h-bridge-motor-driver
Voltage Range 7-24V

If they dont work out then either the Pololu Simple High-Power Motor Controller 24v12 
or the Pololu TReX Dual Motor Controller DMC01

I prefer the TReX, dual motor control with third output that we could use to drive a bilge pump.

Significant differences in costs but also in their capabilities.


Prototype L298N info

Test info – In a wiper test (motor drive forward/reverse) in a loop. Driver got only slightly warm, the Preslite motors are rated at 2amp draw. TReX Dual Motor Controllers will be used as they are more robust, with current limiting and able to drive three motors, 2 biDirectional and one Single Direction motor.

The TRex would be able to drive Main Sheet winch, Rudder Winch and bilge pump.

IMG_20151204_224806

Code for above L298N Prototype

// connect motor controller pins to Arduino digital pins
// motor one Main Sheet
int enA = 10;
int in1 = 9;
int in2 = 8;
int mainPin = A0;  //input A0 for mainsheet
int mainVal = 0;  // int to hold main Input value (507 neutral)

// motor two
int enB = 5;
int in3 = 7;
int in4 = 6;
int rudderPin = A1; //input A1 for rudder
int rudderVal = 0;  // int to hold main Input value (507 neutral)

void setup()
{
  // set all the motor control pins to outputs
  pinMode(enA, OUTPUT);
  pinMode(enB, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
 
  Serial.begin(38400); // to cross check throw so i can set values relevant to deflection / tremor removal
 
   
}

void loop (){
  // Main Sheet deadbands
  mainVal = analogRead(mainPin);
  Serial.print("Main Val = ");
  Serial.print(mainVal);
  if (mainVal >= 900)
  {
    mainOut();
  }
  else if (mainVal <= 100 )
  {
    mainIn();
  }
  else
  {
    mainStop();
  }

  // Rudder control deadbands
  rudderVal = analogRead(rudderPin);
  Serial.print("Rudder Val = ");
  Serial.print(rudderVal);
  Serial.println();
  if (rudderVal >= 900)
  {
    rudderOut();
  }
   else if (rudderVal <= 100 )
  {
    rudderIn();
  }
    else
    {
     rudderStop();
    }
    
    
}

void mainOut() {
  // this function will let the main sheet out
  // turn on motor A 'forward'
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  analogWrite(enA, 200);  // main out speed
}

void mainIn() {
  // this function will pull the main sheet in
  // turn on motor A 'reverse'
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  analogWrite(enA, 200); // main in speed
}

void mainStop () {
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
}


void rudderOut() {
  // this function will rudder right
  // turn on motor B 'forward'
  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
  analogWrite(enB, 200);  // main out speed
}

void rudderIn() {
  // this function will rudder left
  // turn on motor B 'reverse'
  digitalWrite(in3, LOW);
  digitalWrite(in4, HIGH);
  analogWrite(enB, 200); // main in speed
}

void rudderStop () {
  digitalWrite(in3, LOW);
  digitalWrite(in4, LOW);
}

 

Test Pilot and Sponsor – Brendan Hain
Maker – Tony Matthews

Servo City Wireless Joystick using nRF24L01(+) 2.4Ghz Radios

Components.

Transmitter

IMG_20150803_175302

 

 

 

 

 

 

 

Single Cell LiPo Battery, Arduino Nano V3.0, nRF24L01(+)

IMG_20150803_175324
 

 

 

 

 

 

 

TX code

/*
Written by: Mujahed Altahle
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/
or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
*/
 
/* A simple Project for Remote Controlling with nRF24L01+ radios.
We have 2 nodes, the transmitter (this one) and the receiver which is attached to the Car.
The idea is to transmit 2 parameters , one is Direction (Backward, or Forward with the speed) the other is the Steering (Left, or Right with the degree of rotation).
The nRF24L01 transmit values in type of "uint8_t" with maximum of 256 for each packet, so the values of direction is divided by (10) at the Tx side,
then it is multiplied by 10 again at the Rx side.
The Rx rules is to output the received parameters to port 3 and 6 where the Servo and the ESC are are attached
a condition is required to prevent the controller from transmitting values that is not useful (like 1480-1530 for ESC and 88-92 for Servo) to save more power as much as we can
*/
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
//
// Hardware configuration
//
// Set up nRF24L01 radio on SPI bus plus pins 9 & 10
RF24 radio(9,10);

uint8_t data[2] ; //buffer to store received data
const uint8_t buffer_size = sizeof(data);
//pins that used for the Joystick
const int analogInPinY= A0; //
const int analogInPinX = A1;//
const int tx_led=2;// transmission indicator
int Y_value = 0; // values read from the pot
int X_value = 0;
int outputValue = 0;
/*
const int transmit_pin=6;
int transmit_enable;
int ForwrdButton=2;
int BackwrdButton=3;
*/
//
// Topology
//

// Single radio pipe address for the 2 nodes to communicate.
const uint64_t pipe = 0xE8E8F0F0E1LL;


//
// Setup
//

void setup(void)
{

  Serial.begin(57600);
  printf_begin();

  //
  // Setup and configure rf radio
  //

  radio.begin();

  radio.openWritingPipe(pipe);
  //
  // Dump the configuration of the rf unit for debugging
  //

  radio.printDetails();

  //
  // Set up buttons
  //

  /*to be used later
pinMode(ForwrdButton,INPUT );
pinMode(BackwrdButton,INPUT);
pinMode(transmit_enable,INPUT);
*/
  pinMode(tx_led,OUTPUT);
  digitalWrite(tx_led,LOW);

}

//
// Loop
//

void loop(void)
{

  X_value = analogRead(analogInPinX);
  data[0] = map(X_value, 0, 1023,100 , 200);
  Y_value = analogRead(analogInPinY);
  data[1] = map(Y_value, 0, 1023, 135, 45);
// transmit_enable=!digitalRead(transmit_pin);
  //an error ratio around +3,-3 appears coming from the Joystick all the time,
  //so we neglect them (using the following if statement) because they make the system transmitting data always and they are useless and waste of power
  if((data[0]>153 || data[0] <=149) || (data[1]>=92 || data[1]<88))
  {
    //printf("Now sending…");
    bool ok = radio.write( data, buffer_size );
    //if (ok)
    printf("ok\n\r");
    // else
    printf("failed\n\r");
    // delay(15);
    digitalWrite(tx_led,HIGH); //turn led on after transmission
  }
  else digitalWrite(tx_led,LOW);//keep led off when no transmission
}

 

Receiver

Powered by BEC on RC car ESC

Arduino Nano V3.0, nRF24L01(+)

RX Code

/*
 Written by: Mujahed Altahle
 
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/
or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.

 */
/* A simple Project for Remote Controlling with nRF24L01+ radios.
 We have 2 nodes, the transmitter (this one) and the receiver which is attached to the Car.
 The idea is to transmit  2 parameters , one is Direction (Backward, or Forward with the speed) the other is the Steering (Left, or Right with the degree of rotation).
 The nRF24L01 transmit values in type of "uint8_t" with maximum of 256 for each packet, so the values of direction is divided by (10) at the Tx side,
 then it is multiplied by 10 again at the Rx side.
 The Rx rules is to output the received parameters to port 3 and 6 where the Servo and the ESC are are attached
 a condition is required to prevent the controller from transmitting values that is not useful (like 1480-1530 for ESC and 88-92 for Servo) to save more power as much as we can
 */
 
#include <Servo.h>
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
//
// Hardware configuration
//

// Set up nRF24L01 radio on SPI bus plus pins 9 & 10
RF24 radio(9,10);

Servo servo; //steering servo declaration
Servo esc; // Electronic Speed Contoller declaration

// Single radio pipe address for the 2 nodes to communicate.
const uint64_t pipe = 0xE8E8F0F0E1LL;

//
// Payload
//

uint8_t received_data[2];
uint8_t num_received_data =sizeof(received_data);

//
// Setup
//

void setup(void)
{
  delay(3000); //wait until the esc starts in case of Arduino got power first
  servo.attach(3);  // attaches the servo on pin 3 to the servo object
  esc.attach(6);  // attaches the ESC on pin 6 to the ese object  
  servo.write(90);
  //
  // Print preamble
  //

  Serial.begin(57600);
  printf_begin();

  //
  // Setup and configure rf radio
  //

  radio.begin(); //Begin operation of the chip.
  // This simple sketch opens a single pipes for these two nodes to communicate
  // back and forth.  One listens on it, the other talks to it.
  radio.openReadingPipe(1,pipe);
  radio.startListening();
  //
  // Dump the configuration of the rf unit for debugging
  //
  radio.printDetails();
}


void loop(void)
{
  // if there is data ready
  if ( radio.available() )
  {
    bool done = false;
    int ESC_value;
    while (!done)
    {
      // Fetch the payload, and see if this was the last one.
      done = radio.read( received_data, num_received_data );
      ESC_value=received_data[0]*10; //Multiplication by 10 because the ESC operates for vlues around 1500 and the nRF24L01 can transmit maximum of 255 per packet
      esc.writeMicroseconds(ESC_value);
    //  Serial.println(ESC_value);
      servo.write((received_data[1]));
     // Serial.println(received_data[1]);
    }
  }
}

 

Wii Joystick – Electric assist

Had a stroke ? or a brain injury of some sort ?

Low on power and you would like to still sail solo* ?

IMG_20150125_232135This Joystick (and the attached winches) lets you loose on the Broadwater.

– Control Main Sail
– Rudder control
How does it work ?

Pushing the joystick on the Wii forward/up, the main sheet is fed out by the winch.
Pulling the joystick down/back, winds the main sheet in.

Located inside the Rudder it allows comfortable, familiar, single handed sailing.

 

…but it can be moved and remounted (with sufficient time for preparation) to a position that is more comfortable for the sailor.

…We even have WiFi Versions for CORDLESS CONTROL ! Yes, chin control is even possible.

 

 

 

*solo sailing requires training/assessment at Sailability Gold Coast, full training is provided with our progression program. All our sailors (in the 2up access dinghies, are encouraged to take control and learn as they are able)

Freedom on the water ! Energy ! Enjoyment – Sailability Gold Coast

– Talk to Tony (that rather large dude in the three wheel wheelchair) or the Volunteers at the sign in Desk to take the Wii control for a spin.

 

Want to make one your self ? Below is a bit of a 'how to'

From another club in Australia or abroad and want one for your club but not keen on building it up ?

Talk to me, Tony Matthews (also web admin here) and ill see what i can do to help out. My contact email is tony@sailabilitygc.org, I've a significant brain injury myself and really understand the frustration an injury can cause .

 

Specs
Voltage : 6.6v – 30 volts
Battery : 2 cell Lithium , 14.4v Sealed Lead Acid, or 24v Sealed Lead acid
LVC : 6.6volts (to suit LiPo Max Discharge)
HVC : 30volts (to suit 28.8 of 24v Sealed Lead acid battery)

IMG_20150125_232135

Universal Plugs as per Sailability Gold Coasts other Winch assist vessels.
White – Main Sheet , Blue – Battery


IMG_20140703_130020[1] IMG_20140703_130015[1]
Power Sail assist Joystick mounted in a 303 Access Dinghy

 

How it was made.

1. A Nintendo Wii Controller + A Pololu High Power Bidirectional Motor driver

2. Join the Motor driver to the joystick.

IMG_20150125_215915 IMG_20150125_215957 IMG_20150125_215905 IMG_20150125_215858 IMG_20150125_215851

2a. Connect Battery and motor wires to output of Motor Controller

2b. Connect Pololu Motor Controller to your PC, use Pololu 'Simple Motor Controller Center' to set

– Low Voltage Cut off

– High Voltage Cutoff

– Calibrate Joystick

 

 

3. Stick the wired up bits back inside the case,

IMG_20150125_223929 IMG_20150125_223913

 

4 , Jam it inside a bit of 40mm PVC tubing with the wires sticking out of it.

IMG_20150125_232217 IMG_20150125_232209 IMG_20150125_232149 IMG_20150125_232145

 

Motor Driver Controller software makes it very easy to calibrate the Joystick , set direction and battery safety limits.

 

Two or more motor drivers could fit there,

– Main Sheet winch control

– Jib Sheet winch control

– Electric Bilge Pump

 

Please see my other builds for the wireless version of this Joystick.

 

Cheers

Tony Matthews
tony@sailabiltygc.org
     

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Sucess with Wii Nunchuck control of Access Dinghy

In on boat testing today,

A Losi LOSB9522 Brushed ESC was used today to control the main sheet servo for a disabled sailor.

The neutral position was different but other than that it worked very well.

Changes made to the Wii Nunchuck 2.4ghz wireless model to LOSB9522 Brushed electronic speed controller are listed below.

 

Testing today was with one skipper and one disabled sailor.

Wii Nunchuck holder was made from a piece of PVC pipe, bottom was sleeved for a nice fit over the existing joystick rudder control.

Sailor was able to steer the boat and control main sheet with the one hand as his particular needs dictated.

This made for a very comfortable and natural sail according to the delighted sailor.

IMG_20140703_130015[1]IMG_20140703_130020[1]

 

// Note : Xcar esc not suitable as reverse is to under powered (esc is not able to be reprogrammed)

// Wii Nunchuck 2.4ghz wireless to Losi LOSB9522 Brushed ESC
// The values below work for my Losi Strike Brushed ESC

#include <Wire.h>
#include <Servo.h>
#include <wiinunchuk.h>

 

Servo escnine; // Electronic Speed Controller One declaration
Servo escfive; // Electronic Speed Controller Two declaration
int neu = 128; // default zero value for X, Y axis


void setup(void)
{
  nunchuk_init();
  delay(50);
  nunchuk_calibrate_joy();

  delay(20); //wait until the esc starts in case of Arduino got power first
  escnine.attach(9, 700, 2000); // attaches the esc to digital pins and
  escfive.attach(5, 700, 2000); // sets max values and the neutral area
 
 
  escnine.write(neu); // Write neutral value.
  delay(20);

  Serial.begin(57600);
  }

  void loop() {

  nunchuk_get_data(); // receives 6 data bytes from controller

  Serial.print("X = ");
  Serial.print(nunchuk_cjoy_x());
  Serial.print("   Y = ");
  Serial.println(nunchuk_cjoy_y());

 

  // Stabilize Wii output and
  // set Max values for Wii X to counter the esc 50% reduction in reverse
  if (nunchuk_cjoy_x() <= 75)
    escnine.write(7);

  else if (nunchuk_cjoy_x() >= 150)
    escnine.write(150);

  else {
    escnine.write(nunchuk_cjoy_x());
  }

  // Stabilize Wii output and

 

  // set Max values for Wii Y to counter the esc 50% reduction in reverse
  if (nunchuk_cjoy_y() <= 75)
    escfive.write(7);

  else if (nunchuk_cjoy_y() >= 150)
    escfive.write(150);

  else {
    escfive.write(nunchuk_cjoy_y());
  }

  delay(20); // ESCs will only change every 20ms
}

 

 

 

 IMG_20140622_152331  IMG_20140622_152324 IMG_20140622_150700 IMG_20140622_150643 IMG_20140622_150447 IMG_20140622_150438 IMG_20140622_150431 IMG_20140622_145059 IMG_20140622_145052 IMG_20140622_145030 IMG_20140622_141523 IMG_20140622_141439

 

 

 

 

 

Wireless Control for Access Dinghies…and bigger boats.

This page will hold build information for Wireless Motor/servo control intended for use with in a Access Dinghy by and for sailors wanting/needing electrical and mechanical assistance with Rudder and Main sheet Control.

…tho, you need not be actually in the boat …yep full scale Radio Controlled Sailing definitely a possibility, dependent on the transmitter used.

 

Earlier Versions used quite expensive components , a picture of one of the earlier builds is below.

Polou Version Adruino Nano and RF24

The current build uses a wireless Wii Nunchuck – from the Nintendo gaming console.

One of these…FICZRAGG2HE082W.MEDIUM

 

Wired Wii Nunchuck internals, Gnd, SDA, SCL, VDD pinsFor reverence, above picture is internals of wired Wii Nunchuck
showing top to bottom wiring, Gnd, SDA, SCL, VDD

 

Detailed but outdated information was available ….and this caused a few headaches, who knew there were so many variants of IDE (Integrated Development Environment) available, being the place where you upload the code to the the Adruino board of your choice.

This Blog had me very interested , in that here was the possibility of shrinking and making more tidy the things i had been housing in plastic lunch boxes..

http://www.instructables.com/id/Wireless-Wii-Nunchuck-control-of-Arduino-projects/

I am using a generic Adruino Nano V3.0 , which comes with the boot loader installed and a USB plug to upload the sketches.

Here is a picture of the Adruino Nano + prototype board , connected to the Wii Nunchuck receiver (the small white box with the colored wires coming out of it)

IMG_20140609_171943

 

22 June 2014

Finished product – how to.

1.  You'll need some Software – written in the Adruino IDE ver 1.0.5 
Available here – http://arduino.cc/en/main/software

2. Some code to put inside the IDE – located at the bottom of this article.

3. You'll need a Wii Nunchuck – I used a 2.4ghz version
2.4ghz wii nunchuck

4. 1 x  Adruino Nano v3.0 or similar. – available pretty much everywhere, Jaycar, dx.com, sparkfun electronics..

5. Electronic speed control of some sort. In this build i have used some a Brushed 'X-Car' 45amp from Hobby King Australia.

6. Some hook up wire, circuit board lacquer, box to put it in, and power connections of your choice.

 

Following is a rough guide to how i assembled the Wii Nunchuck receiver

Please bear in mind the code i have written is for the X-car receiver – a great many hours of testing to find the right settings, went into the values i have used.

Should you use a different ESC you will need to edit the settings to find 'neutral' for your esc.

If i had more of them i would off used Losi Brushed esc's as the one i have from my Losi Strike was pretty much plug and play – with equal reverse and forward power (programmable)

 

 

Step one.

Load the software onto your Adruino – soft wire the connections – a development board is handy for this.
…i need to first test ; the code, Nunchuck, Nunchuck dongle wiring and esc to make sure there are no faulty components.

I put some balance leads on the Wii dongle while i was testing so that i did not damage it….again..Yep , magic white smoke from the first one from reverse wiring the power leads late at night.

 IMG_20140607_130930Nunchuck Dongle still in the case,

IMG_20140607_130939Nunchuck Dongle with case lid partially removed ,

IMG_20140607_131515This is the one that i damaged (reverse polarity), damage to L2 located near the red wire ,

IMG_20140607_131531Anther shot incase the case,
I hope to be able to fit an Adruino tiny or some variant,
inside this case…seems like there's heaps off room 🙂

IMG_20140608_082604Board removed from case,
Note the underside of the board has the labels for each wire,
this makes it much easier to hook up if you are soldering it together.

IMG_20140608_1027503cell LiPo  Balance lead that i used as extension lead,
Pre moving the wires to match the Wii dongle colour order.

IMG_20140608_104240After the wires were moved over ,

IMG_20140609_171943All wired up read to load software …and hours of testing to find right settings.
…there is no short cut, every esc has a ball park setting it will run on but each will need their own tweaks to get working as intended.

 

After you have Tested it and gone slightly mad with frustration…

IMG_20140622_141439

Remove the excess pins from your Adruino,
unless you were smarter than me and purchased one with out the pin headers
soldered on, tho this did make it much easier to attach to the prototype board.

 

 

Solder connectors to the board,
you could just hard solder it up but this way (with some plugs)
The Wii interface is able to be taken out or other components replaced as need dictates.

IMG_20140622_141523LiPo Balance lead from earlier (other half of it, also repositioned the wires to match Dongle wiring order)
Two esc/servo connectors – I used a Y lead with the end chopped off.

 

IMG_20140622_145030As the pin spacing on the Adruino Nano V3.0 are quite small,
I used the hard pins from the freetronics learner kit to get through the
remaining solder from the pin headers, removed earlier.

 

IMG_20140622_145059Clear heat shrink let me see if any of the wires came undone mid assembly.

IMG_20140622_150431Underside of assembled Adruino

IMG_20140622_150438

Close up of under side of assembled Adruino

IMG_20140622_150447One more…for good measure 😛 

 

IMG_20140622_150643Board was covered with spray on board sealant and heat shrink put over the top.

     IMG_20140622_150700Completed Wii Components and Adruino interface.

Then all there was to do was put it in a box,
Velcro was used to hold the individual components from sliding around.

IMG_20140622_152324…the scissors are just to hold the Wii Nunchuck upright while i too the picture.

IMG_20140622_152331

 A few important things.

The Nunchuck was wired to + 3.3v on the Adruino Board.

The esc Y lead i cut up , only one of them has the
red wire connected to Vin on the Adruino Board.

This is still a work in progress as new ideas
are put forward by the Sailability volunteers and sailors.

All off the above was built using software designed by others under
the Creative Commons License, feel free to hack/change/mod/upgrade.

 

…the way this had been assembled would make it very easy to use in pretty much an RC Car out there

Below are videos, i used RC car parts as the first prototypes
Building the RC Lawnmower in the process.

 

 


And if you have read this far … Below is the code used for the X-Car ESC from Hobby King.

It would need to be changed for other ESC's

 

 

// Notes
// This sketch was tweaked to operate BRUSHED X-45 Hobby King ESC from a car.
// To operate winch motors on a disabled sailing dinghy.

// == The different limit values for the Nunchuck are deliberate.
// compensating for the ESC's 50% reduction in power when in 'reverse'
// Values from the wii nunchuck were also a little erratic in reverse,
// The if , if else , statements also helped with this.

// As this particular ESC reads neutral immediately upon start up
// and the Adruino is powered from the esc, the mapping was the only way to get neutral reliably.
// This Sketch was written for Sailability Gold Coast by Tony Matthews with
// Help from 'AustinDavid' – endless sphere forums./ Help from 'AustinDavid' – endless sphere forums.


#include <Wire.h>
#include <Servo.h>
#include <wiinunchuk.h>

 

Servo escnine; // Electronic Speed Controller One declaration
Servo escfive; // Electronic Speed Controller Two declaration
int neu = 128; // default zero value for X, Y axis


void setup(void)
{
  nunchuk_init();
  delay(50);
  nunchuk_calibrate_joy();

  delay(20); //wait until the esc starts in case of Arduino got power first
  escnine.attach(9, 300, 2000); // attaches the esc to digital pins and
  escfive.attach(5, 300, 2000); // sets max values and the neutral area
 
  delay (1000); // Arming section
  escnine.write(neu); // Write neutral value.
  delay(20);

  Serial.begin(57600);
  }

  void loop() {

  nunchuk_get_data(); // receives 6 data bytes from controller

  Serial.print("X = ");
  Serial.print(nunchuk_cjoy_x());
  Serial.print("   Y = ");
  Serial.println(nunchuk_cjoy_y());

 

  // Stabilize Wii output and
  // set Max values for Wii X to counter the esc 50% reduction in reverse
  if (nunchuk_cjoy_x() <= 75)
    escnine.write(75);

  else if (nunchuk_cjoy_x() >= 155)
    escnine.write(155);

  else {
    escnine.write(nunchuk_cjoy_x());
  }

  // Stabilize Wii output and
  // set Max values for Wii Y to counter the esc 50% reduction in reverse
  if (nunchuk_cjoy_y() <= 75)
    escfive.write(75);

  else if (nunchuk_cjoy_y() >= 155)
    escfive.write(155);

  else {
    escfive.write(nunchuk_cjoy_y());
  }

  delay(20); // ESCs will only change every 20ms
}

 

//end code