New Wiiceiver code!! testers wanted

austindavid

100 W
Joined
Apr 15, 2014
Messages
204
Hey guys- I just did a lap around my house on my [strike]tank[/strike]AT board. The board was always pretty torquey and I really didn't use the raw throttle much, I relied heavily on cruise for the ... control.

The lap I did was through the backyard, definitely a new loop, and on the raw stick. I'm actually surprised because I didn't tune (or de-tune) the setup, I was expecting to need to do more work.

This new code is pretty nice, and I'm looking for a few more feet on it to shake out any issues.

Features:
- cruise control (same), drag brake control (new; like backward cruise)
- better handling around neutral -- more responsive throttle & brakes
- coming soon: interactive benchtop setup with a chuck -- like programming the ESC, but no card required.
- maybe (definitely need more ESCs for this): better ESC syncup

Ping me if you can flash your own wiiceiver and want to give it a whirl.
 
Hello

i've update the new code 2.0 on the wiiceiver and feels much better all around
Austin you nailed again on this one.

improvements:

0- the new configuration mode on the code to allow a better customization.

1- fixed starting speed. Now don't need to worry for friends messing up your C button configuration.

2- the replacement of the turbo Z button for a Cruise control brake Z button, no more fidgeting with the joystick to try set a steady drag force when going downhill on a long slope. Now all you need is to press Z button to get your customizable initial brake force and adjust it from there with the joystick like the Cruise control feature of the C button.

3- The customization of the acceleration profile. there's no need to reprogram the ESC if you need a different acceleration profile you can set it up from the wiiceiver no need of a program box. just pick a poison from this list and go.

½ rate acceleration
75% acceleration
default acceleration
125% acceleration
150% acceleration
200% acceleration
“raw”, no acceleration limits (same as C+Z, but all the time)

get this code and have fun :D :D :D
 
Austin, thank you for all of the work you have done on this project. I would love to test the newest code updates. Can either of you point me to some instructions or documentation for flashing the wiiceiver board that Torqueboards sells? Thanks!
 
Hi Ecycler,

Here is the Austin's instructions. You'll need some male to male jumper wires.

https://docs.google.com/document/d/1OMyipDXwUIevf9hT1LSHdhx5EEQ6rP9OY-iQ6avuLok/edit#

1) remove the chip from the Uno -- literally pry it out of the socket. Save it!
2) connect jumpers from Uno -> Wiiceiver, using the 6-pin header on the Wiiceiver (5 holes through the heat shrink, #1 is near the edge of the board, #6 toward the center; position #5 is unused)
5V -> #1
RESET -> #2
RX 0 -> #3
TX 1 -> #4
<empty> #5
GROUND -> #6
3) plug in the Uno’s USB to your computer
4) Upload as if this were an Uno. The Uno’s TX/RX LEDs should light up and remain solid for several seconds while the code is uploading; after upload the wiiceiver will enter the startup sequence and the red/green LEDs will get all blinky. You can access debugging info in the serial monitor.
 
sounds like this might solve some of my issues. i have a very torquey board and its very hard to handle without cruise control buttons with the wiiceiver/nunchuck combo right now. the blending of acceleration doesnt feel intuitive for me, coming from an evolve ... i can most likely tune that with an upper (low) limit of the acceleration - right now the board just drags harder and harder and eventually i pull back the nunchuck lever again. somehow its hard to develop a feel for the blending function.
at the same time cruise control always works on the stick position and not on the boards current speed which leads to annoying effects when you rearrange your grip to comfortably press C and the lever position was off (guess that would be near impossible to change though).

would love to customize the software, snooped around in github and it looked quite doable to understand the code. is there a quick summary of "how to get started", mayby for starters with "what do i need to flash the software". ill have a look later, probably figure it out on my own quickly, just dont have too much time until the weekend. :p

p.s.: nvm the last bit, 2more posts, thx dexter!
 
Yes, thank you, Dexter. You are definitely the eboard virtual god of sorts. I will give it a go and look forward to swapping the C and Z button functionality. For some reason I have a similar issue to whitepony where it is just really hard for me to control the joystick and hold the c button simultaneously, but the z is no problem. I will flash the newest updates from github after swapping those buttons in the code when I get back home in a few weeks.
 
yeah, Dexter is the king. None of this would exist without his help.

I made some minor updates on the instructions based on some comments from Kaly (thank you):
https://docs.google.com/document/d/1OMyipDXwUIevf9hT1LSHdhx5EEQ6rP9OY-iQ6avuLok/edit#

ecycler: I'll send you a PM with some simple instructions on swapping C and Z.
whitepony: PM inbound too
 
ecycler said:
Yes, thank you, Dexter. You are definitely the eboard virtual god of sorts. I will give it a go and look forward to swapping the C and Z button functionality. For some reason I have a similar issue to whitepony where it is just really hard for me to control the joystick and hold the c button simultaneously, but the z is no problem. I will flash the newest updates from github after swapping those buttons in the code when I get back home in a few weeks.

NM the PM, here's what you can do: lines 152-3 in Chuck.h:

C = ((status[5] & B00000010) >> 1) == 0;
Z = (status[5] & B00000001) == 0;

trade the C&Z to change those lines like:
Z = ((status[5] & B00000010) >> 1) == 0;
C = (status[5] & B00000001) == 0;


Then use a sharpie to write "Z" on the top button, "C" on the bottom ;)
 
Hello David,

I've been using your wiiceiver code for some time now and it works great! Thanks a lot for that!
I've been trying to use your wiiveiver2.0 code on my arduino UNO but it doesn't seem to want to compile the code.
First I had to change the #include "tuna.h" by a #include "Tuna.h" in Wiiceiver.ino
Then the following errors were reported


In file included from Wiiceiver_2_0.ino:49:0:
watchdog.h:47: error: variable or field 'watchdog_setup' declared void
void watchdog_setup(byte wd_interval) {
^
watchdog.h:47: error: 'byte' was not declared in this scope
watchdog.h:57: error: expected constructor, destructor, or type conversion before '(' token
ISR(WDT_vect) {
^
watchdog.h: In function 'void display_WDC()':
watchdog.h:65: error: 'byte' was not declared in this scope
byte wdt_counter = EEPROM.read(EEPROM_WDC_ADDY);
^
watchdog.h:65: error: expected ';' before 'wdt_counter'
byte wdt_counter = EEPROM.read(EEPROM_WDC_ADDY);
^
watchdog.h:66: error: 'Serial' was not declared in this scope
Serial.print("Watchdog Resets: ");
^
watchdog.h:67: error: 'wdt_counter' was not declared in this scope
Serial.println((byte)(wdt_counter + 1));
^
In file included from Wiiceiver_2_0.ino:52:0:
pinouts.h: In function 'void chipSelect()':
pinouts.h:67: error: 'analogRead' was not declared in this scope
int A6Sel = analogRead(6);
^
pinouts.h:73: error: 'INPUT_PULLUP' was not declared in this scope
pinMode(13, INPUT_PULLUP);
^
pinouts.h:73: error: 'pinMode' was not declared in this scope
pinMode(13, INPUT_PULLUP);
^
pinouts.h:74: error: 'digitalRead' was not declared in this scope
if (digitalRead(13) == HIGH) {
^
pinouts.h:74: error: 'HIGH' was not declared in this scope
if (digitalRead(13) == HIGH) {
^
pinouts.h: At global scope:
pinouts.h:123: error: 'byte' does not name a type
byte readSetting(int eeprom_addy, byte default_value) {
^
In file included from Wiiceiver_2_0.ino:65:0:
Smoover.h: In member function 'void Smoover::init()':
Smoover.h:95: error: 'readSetting' was not declared in this scope
byte accelProfile = readSetting(EEPROM_ACCELPROFILE_ADDY, 2);
^
In file included from Wiiceiver_2_0.ino:70:0:
Cruiser.h: In member function 'void Cruiser::init()':
Cruiser.h:136: error: 'readSetting' was not declared in this scope
autoCruise = 0.01 * readSetting(addy, autoCruise*100);
^
In file included from Wiiceiver_2_0.ino:84:0:
Tuna.h: In function 'void factory_reset()':
Tuna.h:51: error: 'watchdog_setup' was not declared in this scope
watchdog_setup(WDTO_250MS);
^
Tuna.h: In function 'void ui_getThrottle(int, int, int)':
Tuna.h:113: error: 'readSetting' was not declared in this scope
float throttle = 0.01 * readSetting(eeprom_addy, 0) * sign;
^
Tuna.h: In function 'void ui_accelprofile(int)':
Tuna.h:148: error: 'readSetting' was not declared in this scope
int profile = readSetting(EEPROM_ACCELPROFILE_ADDY, 2);
^
Tuna.h: In function 'void showTunaSettings()':
Tuna.h:192: error: 'readSetting' was not declared in this scope
Serial.println(readSetting(EEPROM_AUTOCRUISE_ADDY, 255));
^
Tuna.h: In function 'void tuna()':
Tuna.h:244: error: 'watchdog_setup' was not declared in this scope
watchdog_setup(WDTO_250MS);
^
Wiiceiver_2_0.ino: In function 'void handleInactivity()':
Wiiceiver_2_0:248: error: 'watchdog_setup' was not declared in this scope
Wiiceiver_2_0.ino: In function 'void setup()':
Wiiceiver_2_0:330: error: 'watchdog_setup' was not declared in this scope
variable or field 'watchdog_setup' declared void


Do you have any idea what the problem could be?

Thanks a lot
 
add:
#include <Arduino.h>

to the top of Wiiceiver.ino -- this is correct in the latest in 2.0 on Github: https://github.com/jaustindavid/wiiceiver/archive/2.0.zip

sorry for the Tuna / tuna thing; my Mac doesn't seem to care. I've updated on Github too, but the manual edit is fine.
 
Any feedback, guys? I really want to be sure it's solid on ESCs, in addition (of course) to the new control code.

Also I'm offering a free upgrade (in the form of a programmed ATmega328 + replacement heat shrink) for anyone who bought a wiiceiver kit from me or torqueboards -- free shipping too (in the US).

austindavid.com/wiiceiver, scroll to the bottom for the "buy it now" upgrade button, or PM me with your address.
 
I promise Ill get to it soon - just waiting for a clear schedule :)

p.s.: today I had some time for reading ... ordered arduino uno & some male-male jumper cables now. :wink:
 
I’ve just downloaded the zip from github, failed compilation for the Wiiceiver_2_0
I also had compile problems as mentioned earlier, added '#include <Arduino.h>' into Wiiceiver_2_0.ino
and rename 'tuna.h' to 'Tuna.h'
also failed on every line that contains EEPROM.update(...
changed all of them to EEPROM.write(... and compiled fine.
I'm using Arduino v1:1.0.5 on linux mint

Using a Homann board but cant reflash, the reversed labels stuffed me up so gotta find what (if) died. Still runs the old code. Uploads fine on one of my pro mini derivatives.

What's the simplest way to mod the code for aeroplane ESC?, im running one and neutral stick is 50% power, stick fully down is 0 power, obviously no brakes on this ESC.
The only reason is if the chuck were to drop out the board will run away instead of coast. I think you mentioned somewhere a parameter in the 2.0 code for this..
 
wldmki said:
I’ve just downloaded the zip from github, failed compilation for the Wiiceiver_2_0

please use the link I gave above. That's the correct version, the code is just "Wiiceiver".

for Heli / airplane ESC: change line 40 to
#define ALLOW_HELI_MODE

When you run the setup code, the new first setup value is after 1 blink, defaults to "1". Use up or down on the stick to get 2, hit C, proceed with the throttle / brake setup. When that's done you have a wiiceiver in "heli" mode.

I did this once and confirmed it worked, and that I don't like the airplane ESC. Be prepared to troubleshoot some behavior, it's probably gonna act weird. Specifically the Z button is now a partial throttle to make brakes work, like if you hold Z your ESC doesn't go to neutral, it goes to the slowest configured throttle.
 
received my arduino uno today (only 15€ new on ebay) and with some male male jumper cables it took me 5minutes until I actually had the wiiceiver flashed to version 2.0. first impressions: I love the startup now - this new calibration procedure REALLY helps a lot to adjust the nunchuck to your setups peculiarities. I also really like the max acceleration adjustment just by setup procedures - very effective from what I can tell.
sadly I couldnt try the Z drag braking yet, because the weather is horrible - all first impressions were achieved by cruising around in the living room. needless to say, my dog wasnt too happy about it. :p

will give more feedback once the weather allows skateboarding again. so far Im really happy with the changes, particularly startup and minimum speed cruising from stand still with C.
 
Hello David!

Thank you for your hard work on this Software!

Added some Lines in your Code. In particular the UI Setup. Nothing fancy!

The Acc. values are now printed to the Terminal too, like the values for Throttle and Brake.

Maybe you want to add it. I use the terminal for Setup as i am using a Arduino Nano "without" a LED, but with a Bluetooth Connection for inride setup.

Thanks again!

All the best from Germany

EDIT: Using Wiiceiver 2.0 beta 3

Code:
// NOTE: the value # flashed is +1, can't flash "0" times :/
int ui_getValue(byte blinks, byte valueAddy, byte defaultValue, byte maxValue) {
  int newValue = readSetting(valueAddy, defaultValue);
  Serial.print(F("getting value #"));
  Serial.println(blinks);
  flash(green, blinks);
  delay(1000);
  flash(green, newValue+1);
  do {
    chuck.update();
    if (chuck.Y > 0.5) {
      newValue ++;

      Serial.print("Set Acc. to "); // ADDED
      Serial.print(newValue);
      Serial.println(" ? -- Press C to Save");
      if (newValue > maxValue) {
        newValue = 0;

      }
      flash(green, newValue+1);
      delay(20);
      chuck.update();
    } else if (chuck.Y < -0.5) {
      newValue --;

      Serial.print("Set Acc. to "); // ADDED
      Serial.print(newValue);
      Serial.println(" ? -- Press C to Save");
      
      if (newValue < 0) {
        newValue = maxValue;
      }
      flash(green, newValue+1);
      delay(20);
      chuck.update();
    }
    delay(20);
  } while (!chuck.C);
  Serial.print(F("Saving value #"));
  Serial.print(blinks);
  Serial.print(F(" as "));
  Serial.println(newValue);
  EEPROM.update(valueAddy, newValue);
  green.high();
  flash(red, blinks);
  red.high();
  delay(1000);
  return newValue;
} // int ui_getValue(byte blinks, byte defaultValue)
 
Mevel said:
Added some Lines in your Code. In particular the UI Setup. Nothing fancy!

The Acc. values are now printed to the Terminal too, like the values for Throttle and Brake.

Great idea, thank you. I've made a little cleanup, can you try this and tell me what you think?

If you like it I'll push it into the repository. Thanks!

Code:
// NOTE: the value # flashed is +1, can't flash "0" times :/
int ui_getValue(byte blinks, byte valueAddy, byte defaultValue, byte maxValue) {
  int newValue = readSetting(valueAddy, defaultValue);
  Serial.print(F("getting value #"));
  Serial.print(blinks);
  Serial.println("; use stick up/down to change, C to save");
  flash(green, blinks);
  delay(1000);
  flash(green, newValue+1);
  Serial.print("Value: ");
  Serial.println(newValue+1);
  do {
    chuck.update();
    if (chuck.Y > 0.5) {
      newValue ++;   
      if (newValue > maxValue) {
        newValue = 0;
      }
      Serial.print("Value: "); 
      Serial.println(newValue+1);
      flash(green, newValue+1);
      delay(20);
      chuck.update();
    } else if (chuck.Y < -0.5) {
      newValue --;
      if (newValue < 0) {
        newValue = maxValue;
      }
      Serial.print("Value: "); 
      Serial.println(newValue+1);
      flash(green, newValue+1);
      delay(20);
      chuck.update();
    }
    delay(20);
  } while (!chuck.C);
  Serial.print(F("Saving value #"));
  Serial.print(blinks);
  Serial.print(F(" as "));
  Serial.println(newValue+1);
  EEPROM.update(valueAddy, newValue);
  green.high();
  flash(red, blinks);
  red.high();
  delay(1000);
  return newValue;
} // int ui_getValue(byte blinks, byte defaultValue)
 
Works very nice ! Maybe you can add the hint for pressing C to save to Throttle and Brake Input aswell?!


[strike]I am not sure if my Combo is the reason or something else but i might found a little Bug.

Description: After going to Factory Reset with C+Z for 10 sec. The Eeeprom value for cruise is set to 255. But i cant access the Setup again with C+Z for 5 ish seconds.[/strike]

Will look into that behaviour this afternoon.

EDIT: Working fine =)

So long =)
 
I finally got some time over the holidays here to give it a crack. I rode about 10 miles earlier today with the old version and then setup the wiiceiver2.0 when swapping batteries and taking a break. I did the setup with holding down the buttons several times and went through adjusting the throttle, brake, and acceleration profile, but I just can not get the brakes to be light enough when activating them at high speeds. Are they affected by the 'acceleration profile?' They are fine at low speeds, but when I get going above 18-20mph (especially going down a steep hill) even the tiniest touch of the brakes is waaay too much and almost makes me crash because it upsets the board so much. Is there any way to make them come on lighter? I have set my ESC braking profiles down to 40% and any less just causes me to not be able to slow down enough even when I am at full brakes. Any thoughts or tips here? I am using Torqueboards 120A ESC's with 10S of Konions.

Also, I did have one event when I was testing the brakes and let off, then somehow the board went full throttle and threw me on my butt. The problem is that I never hit the throttle and it accelerated way harder than it normally would have even if I had pegged the throttle. Has anyone else had that happen yet with the new code? Quite scary and glad I was not around any people or traffic!
 
The acceleration profile would not change the calibration point; it only changes the rate of change for acceleration or braking. I'll review the code later this weekend to double-check, but the calibration should be clean. Once you set a value for the drag brake, that's what your ESC will get when you press/hold Z.

It can be tricky to choose that value though, and the braking might feel stronger at higher RPM. Try going into the setup again and bringing that value down a little (use C to scroll through the setup options, then bump the stick up a few times to reduce that level) and see if it's better for you. On my boards I can actually hear the sound difference in the motor for when the brakes start. I generally can't actually feel the resistance, but the motor sounds different enough that I can find exactly the point where the brakes kick in. Set at that level, holding Z applies just a tiny bit of braking pressure, and I can use the stick to increase it. Or just use the stick for brakes, whichever.

Now the other thing: that's crazy. I assume you're on the most recent code 2.0 beta3, which was updated about 6 weeks ago?

In the code there's only one way to get the ESC up to full throttle instantly -- C+Z at the same time. When I'm testing I look at that transition brakes -> throttle, or throttle->brakes, very closely. It's a sensitive time for the rider sa your acceleration totally changes, and that's when you've got the hardest time balancing. I also test that standing on the board, for the same reasons. I've never seen the issue you describe.

The ESC could get confused about your calibration level, and if thatt happens ... all bets are off. I don't have one of those 12S ESCs handy so I can't really speak to the performance, but I haven't heard anything bad about it. I should be receiving one soon though.

In the meantime, could you flip your board over, keep the wiiceiver + LEDs where you can see it, and try to reproduce the problem? I'd love to know what the wiiceiver thinks is happening when the ESC goes bananas. I've seen this on specific ESCs, particularly after using brakes for a while. Going from brakes -> neutral, the ESC decides "braking is the new neutral", and when the stick goes up (to neutral) the ESC decides to accelerate. It's terrible, but also hard to reproduce. The Flier ESCs have a setting about auto-calibrating neutral, you generally want that OFF, wiiceiver handles that for you.

I will also ping torqueboards offline and see if I can find a way to sync the throttle range on the ESC (which is independent of wiiceiver setup), that might smooth things out a bunch, and keep it from getting confused.
 
Hey,
I've been using the new code with my Arduino Nano and Nyko Kama.
I've been loving the code but i have a few question, or comments?
1. Sometimes when i use C+Z i.e raw mode, and I'm at a stop light or something i accidentally get into calibration mode and recalibrate the acceleration, which is less to my liking. I though about maybe if you made the entrance into calibration mode with C+Z + full left (or right) on the stick would maybe solve this problem (since nobody uses left to right that i know of).
2. Calibrating with Arduino, I think maybe because the lights on the arduino are different then the WiiCiever I am having a difficult calibrating some of the features on the remote.. like drag brake and minimum speed forward. - Is there anyone who has calibrated with arduino and knows how to do this correctly?
3. Are you using the sensors inside the nunchuck? maybe could be used for acceleration/brake sensitivity (helping people not getting thrown off the board and stuff)
Thanks for the hard work, it's awesome!
Z
 
razad7@gmail.com said:
Hey,
I've been using the new code with my Arduino Nano and Nyko Kama.
I've been loving the code but i have a few question, or comments?
1. Sometimes when i use C+Z i.e raw mode, and I'm at a stop light or something i accidentally get into calibration mode and recalibrate the acceleration, which is less to my liking. I though about maybe if you made the entrance into calibration mode with C+Z + full left (or right) on the stick would maybe solve this problem (since nobody uses left to right that i know of).
2. Calibrating with Arduino, I think maybe because the lights on the arduino are different then the WiiCiever I am having a difficult calibrating some of the features on the remote.. like drag brake and minimum speed forward. - Is there anyone who has calibrated with arduino and knows how to do this correctly?
3. Are you using the sensors inside the nunchuck? maybe could be used for acceleration/brake sensitivity (helping people not getting thrown off the board and stuff)
Thanks for the hard work, it's awesome!
Z


1) Do you use C+Z all the time? You can configure it to be always on if you like. I'm reluctant to change the way to get into setup mode, but if other people are interested I can do it. Not hard to program, but would make it that much harder to run the setup...

2) if you're on an Arduino, use the serial monitor. You get more output, including statements about entering each setup mode.

3) using them to confirm the nunchuck is being held by a human, and not dropped / dead battery. it's also very hard to tell the difference between "nunchuck moved because the user is moving his/her hand" or "nunchuck accelerometer represents exactly what the skateboard is doing."
 
austindavid said:
The acceleration profile would not change the calibration point; it only changes the rate of change for acceleration or braking. I'll review the code later this weekend to double-check, but the calibration should be clean. Once you set a value for the drag brake, that's what your ESC will get when you press/hold Z.

It can be tricky to choose that value though, and the braking might feel stronger at higher RPM. Try going into the setup again and bringing that value down a little (use C to scroll through the setup options, then bump the stick up a few times to reduce that level) and see if it's better for you. On my boards I can actually hear the sound difference in the motor for when the brakes start. I generally can't actually feel the resistance, but the motor sounds different enough that I can find exactly the point where the brakes kick in. Set at that level, holding Z applies just a tiny bit of braking pressure, and I can use the stick to increase it. Or just use the stick for brakes, whichever.

Now the other thing: that's crazy. I assume you're on the most recent code 2.0 beta3, which was updated about 6 weeks ago?

In the code there's only one way to get the ESC up to full throttle instantly -- C+Z at the same time. When I'm testing I look at that transition brakes -> throttle, or throttle->brakes, very closely. It's a sensitive time for the rider sa your acceleration totally changes, and that's when you've got the hardest time balancing. I also test that standing on the board, for the same reasons. I've never seen the issue you describe.

The ESC could get confused about your calibration level, and if thatt happens ... all bets are off. I don't have one of those 12S ESCs handy so I can't really speak to the performance, but I haven't heard anything bad about it. I should be receiving one soon though.

In the meantime, could you flip your board over, keep the wiiceiver + LEDs where you can see it, and try to reproduce the problem? I'd love to know what the wiiceiver thinks is happening when the ESC goes bananas. I've seen this on specific ESCs, particularly after using brakes for a while. Going from brakes -> neutral, the ESC decides "braking is the new neutral", and when the stick goes up (to neutral) the ESC decides to accelerate. It's terrible, but also hard to reproduce. The Flier ESCs have a setting about auto-calibrating neutral, you generally want that OFF, wiiceiver handles that for you.

I will also ping torqueboards offline and see if I can find a way to sync the throttle range on the ESC (which is independent of wiiceiver setup), that might smooth things out a bunch, and keep it from getting confused.


Thank you for the well written reply. That is all very helpful. Yes, I am on the most recent code push, but will double check that. I will see if it might work better if I set the braking back to 100% and try to set the wiiceiver as soft as I can again. I can definitely hear the difference in braking values in the motor. It's been raining a lot, so I might not get to test for a little while longer on the street.

As far as the brakes to FULL throttle event goes, I will spend some time trying to reproduce inside. I definitely do not want to be around pedestrians or traffic until I am confident that it won't be reproduced. I have enough ride time with this setup to know for sure it was not user error, so will test very thoroughly.
 
Back
Top