WII U RASPBERRY PI 3 FINISHED

Want to show off your own project? Want to keep a build log of it? Post it here!
User avatar
Ely
Posts: 26
Joined: Wed Aug 15, 2018 5:44 am
Has thanked: 7 times
Been thanked: 11 times

Re: WII U RASPBERRY PI 3 FINISHED

Post by Ely » Sat Feb 09, 2019 4:20 pm

Nice build Veteran, it's very clean and promising.
Which battery are you using ?
Did you notice any heat problem or safety risk putting it under the screen pcb, pi3 and retro psu ?

jmanfrontier
Posts: 7
Joined: Sun Feb 10, 2019 12:24 am
Been thanked: 3 times

Re: WII U RASPBERRY PI 3 FINISHED

Post by jmanfrontier » Sun Feb 10, 2019 1:26 am

@VeteranGamer,

I am LOVING your build and will try to emulate it myself. Question, what battery did you use? I too have ordered the same charging board you are using from Helder. Which by the way thank you that board is AWESOME!!! I have overlooked your latest picture and will try to trace your wiring from it. If you happen to find the time to throw together a diagram of just the charging/power circuit you have implemented I would be in your debt. As when the wires get down to the power button board I cant see all the wires and where they go at that point. Thanks in advance and everyone a part of this thread is amazing for pioneering this build.

User avatar
VeteranGamer
Posts: 1738
Joined: Thu Jan 26, 2017 11:12 am
Location: London, UK
Has thanked: 528 times
Been thanked: 909 times

Re: WII U RASPBERRY PI 3 FINISHED

Post by VeteranGamer » Sun Feb 10, 2019 5:56 am

Ely wrote:
Sat Feb 09, 2019 4:20 pm
Nice build Veteran, it's very clean and promising.
Which battery are you using ?
Did you notice any heat problem or safety risk putting it under the screen pcb, pi3 and retro psu ?
Thanks....

I think your always gonna get heat problems with a RPi 3

However...

Nothing is touching the battery apart from the back of the screen....

All the components are raised up by a few mm with the aid of VHB...
I’ve also placed thermal pads under the RPi and the screens PCB (Just where necessary)

But it’s still gets warm (as expected from the RPi)
So I do plan on using a heat sink and a fan
(same fan as kite uses in his kits)
But I want to source a battery cover first...
As I want to put some venting in it and would like to have a spare just in case things don’t go to plan

The battery is just a 6000mah battery I found on AliExpress that fitted within the screen holder...
You can go for a larger capacity which will also fit..
But they are slightly thicker, and I wanted the thinner battery for the things I mentioned above..



.

User avatar
blu3rav3n
Posts: 16
Joined: Fri Dec 28, 2018 3:40 pm

Re: WII U RASPBERRY PI 3 FINISHED

Post by blu3rav3n » Sun Feb 10, 2019 11:12 am

Well veterangamer I cant send pm's. Not sure why but none of the pm's ive sent have gone through.
Anywho the new Teensy came in. I wired it up again but now its working slightly better then before but not completely. So the left analog stick wont recognize left or right in the button config of retro pi. Only up and down. Now the right analog sticks works 100%.

This is the code that ive been using for teensy. It matches the pin out guide on the first page so ive using that.

Im racking my brain cause i didnt do anything different but now the right analog sticks works but the left still only half works. I dont know where to go from here.


//Teensy configure script for RetroPie controllers.
//Easy config, and setup for most controllers.
//by Zark Wizard 02/14/17
//ver 1.5
//If you like the script check out gymlete.com free iOS fitness app (GYMLETE in iTunes)
//leave us a review! Thanks.

//-------------- DEBUG DEFINES --------------
//#define DEBUG_BUTTONS 1 // Uncomment this line to debug Teensy
// If you set this to 1, buttons will output their #position so you can calibrate the code
// to use your button config easily

//#define DEBUG_MESSAGE 1 // Uncomment this line to debug Teensy
// If you want to output messages to the Teensy serial debugger uncomment this

//#define DEBUG_JOYSTICKS 1 // Uncomment this line to debug Teensy
// If you want to output messages to the Teensy serial debugger uncomment this
// This is so you can debug the analog joysticks.

#define USECOMMANDBUTTONS 1 // This enables command button availablity
// If you have keyboard commands that need to be available across emulators you
// will want to have command buttons available. If you don't, comment this
// out and it will not call the command functions

//-------------- Generic States --------------
bool CurrentState = true; // true = Joystick, false = Keyboard
int buttonState = 0;
int lastButtonState = 0;

bool DPad2Keys = false; // This is a mode that will switch the dpad to keys instead of buttons
bool LAST_DPad2Keys = DPad2Keys; // They need to start on the same mode

bool GameState = true; // Analog issues - true = N64Mode 1.5, false = PSXMode 1.8
int GameMode = 0;
int lastGameMode = 0;

int Lasthbut = 0;

int tbut = 0;

short Pressed = 0;

#define MODE_LED_USED 1 // comment out this line if you do not want to use a MODE LED.

// This is the pin position we use to flash, and control the LED Sequin
// This project uses https://www.adafruit.com/product/1757
#define FLASH_PIN 23
// Different modes that are available, flashing the LED so we know the mode
#define FLASH_KEYBOARD 4 // This is how many times it will flash
#define FLASHDELAY_KEYBOARD 250 // in ms
#define FLASH_JOYSTICK 10 // This is how many times it will flash
#define FLASHDELAY_JOYSTICK 50 // in ms

#define FLASH_N64 4 // This is how many times it will flash
#define FLASHDELAY_N64 250 // in ms
#define FLASH_PSX 10 // This is how many times it will flash
#define FLASHDELAY_PSX 50 // in ms

#define FLASH_MAME 4
#define FLASHDELAY_MAME 250 // in ms
#define FLASH_NONMAME 10
#define FLASHDELAY_NONMAME 50 // in ms

// Light LED if Button Home is being held down...
// change this to false if you don't want the LED to go solid when home is pressed
#define LIGHT_HOME true

//-------------- Default Multiplier (set to N64 mode) --------------
#define PSX_Value 1.8f
#define N64_Value 1.5f
// Chnaging this will have no effect, it gets set according to GameState
float StickMultiplier = 0.0f; // Change GameState above to false if you want PSXMode to start

// ------------- Left Side
// Joystick Digital Buttons
const int DirUp = 11;
const int DirDown = 22;
const int DirLeft = 12;
const int DirRight = 13;

// Left Side Top Buttons
const int ButL = 14;
const int ButZL = 15;

// ------------- Right Side
const int ButX = 0;
const int ButY = 7;
const int ButB = 4;
const int ButA = 1;
const int ButStart = 6; // Plus
const int ButSelect = 5; // Minus

//Right Side Top Buttons
const int ButR = 3;
const int ButZR = 2;

// ------------- Bottom Row
const int ButHome = 8;
const int ButTV = 9;
const int ButPower = 10;

// ---------------------------
//ANALOG CONTROLLERS REQUIRE ANALOG INPUT MAPPING A0-A10 Teensy 2.0
// ---------------------------

// ------------- Right Stick
// Joystick Analog Buttons
const int JoyRClick = 19; // Click is a digital mapping
const int JoyRVert = 1; // Analog Mapping A1
const int JoyRHorz = 0; // Analog Mapping A0

// ------------- Left Stick
const int JoyLClick = 18; // Click is a digital mapping
const int JoyLVert = 4; // Analog Mapping A4
const int JoyLHorz = 5; // Analog Mapping A5

// Analog Joystick Values required for inversion
int AnalogMap[] = {JoyRHorz, JoyRVert, JoyLHorz, JoyLVert};
bool AnalogInvert[] = {false, true, false, true}; // If you want to invert a stick set a value to true

#define AMAPPING sizeof(AnalogMap)


// ------------------- Mapping Sequence for Scan Routine
//Variables for the states of the various buttons

// ----------- FIRST MAPPING IS THE BUTTON TEST STATE CASE

#ifdef DEBUG_BUTTONS
// DO NOT CHANGE THE DEBUG STUFF... THIS IS FOR THE DIGITAL PINS
//Debug Pin out positions.... If you want to check the location of various pins and buttons
byte buttons[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23
};

unsigned int keys[] = {KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5,
KEY_6, KEY_7, KEY_8, KEY_9, KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F,
KEY_G, KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N
};

#else
// --------------------- CONTROLLER MAPPING
// Order is not important, since the mapping for the buttons is above, it gets
// the pins from what you set above, just map what you want to use..
// Set the buttons you want to use,
byte buttons[] = {DirUp, DirDown, DirLeft, DirRight, ButL, ButZL,
ButX, ButY, ButB, ButA, ButStart, ButSelect, ButR, ButZR,
JoyLClick, JoyRClick
};

// If you are in keyboard mode, map the key you want to press for the
// button you listed above. Make sure to have a 1:1 or you could end
// up with an issue
// ------------------- Mapping Sequence for Keyboard Scan Routine
unsigned int keys[] = {KEY_E, KEY_D, KEY_S, KEY_F, KEY_5, KEY_5,
KEY_X, KEY_Y, KEY_B, KEY_A, KEY_ENTER, KEY_5, KEY_5, KEY_Q,
KEY_ESC, KEY_TAB,
};
#endif

byte CommandButtons[] = {
ButTV
};

unsigned int CommandFunction[] = {
KEY_ESC
};

byte DirectionButtons[] = {
DirUp, DirDown, DirLeft, DirRight
};

unsigned int DirectionFunctions[] = {
KEY_E, KEY_D, KEY_S, KEY_F
};


byte HomeButtons[] = {
ButStart, ButSelect, ButTV, ButX, ButY, ButB, ButA, DirUp, DirDown, DirLeft, DirRight
};

unsigned int HomeFunctions[] = {
KEY_ENTER, KEY_TAB, KEY_F1, KEY_F12, KEY_DELETE, KEY_ESC, KEY_TAB, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT
};

#define NUMBUTTONS sizeof(buttons)
#define CMDBUTTONS sizeof(CommandButtons)
#define HBUTTONS sizeof(HomeButtons)
#define DBUTTONS sizeof(DirectionButtons)

void setup()
{
if (GameState)
StickMultiplier = N64_Value;
else
StickMultiplier = PSX_Value;

#ifdef MODE_LED_USED
pinMode(FLASH_PIN, OUTPUT);
#endif

//Special for the Teensy is the INPUT_PULLUP
pinMode(ButPower, INPUT_PULLUP);
pinMode(ButHome, INPUT_PULLUP);
//It enables a pullup resitor on the pin.
for (byte i=0; i< NUMBUTTONS; i++) {
pinMode(buttons, INPUT_PULLUP);
}

#ifndef DEBUG_BUTTONS
// Command buttons are onle available if we aren't in debugging buttons
for (byte i=0; i< CMDBUTTONS; i++) {
pinMode(CommandButtons, INPUT_PULLUP);
}

#endif
}

int ReadAnalog(int pinPos) {
int pV = analogRead(pinPos);
bool InvertStick = false;

// Scan through the Analog values and see if anything is set to inverse, if it is
// we need to apply the offset validation

for (byte i=0; i< AMAPPING; i++) {
if (AnalogMap==pinPos) {
InvertStick = AnalogInvert;
if (InvertStick)
#ifdef DEBUG_JOYSTICKS
// Joystick print outs to check functions....
Serial.printf("PP %d IP %d ",i,pinPos);
#endif
break;
}
}

if (InvertStick)
pV = (pV - 512) * StickMultiplier - 512;
else
pV = (pV - 512) * StickMultiplier + 512;;

pV = abs(pV);

// Make sure we don't exceen the max and minimum for the analog stick.
// if (pV > 1023)
// pV=1023;
// if (pV < 0)
// pV = 0;

return pV;
}

void AnalogMove()
{
int LeftX = ReadAnalog(JoyLHorz);
int LeftY = ReadAnalog(JoyLVert);

int RightX = ReadAnalog(JoyRHorz);
int RightY = ReadAnalog(JoyRVert);

#ifdef DEBUG_JOYSTICKS
// Joystick print outs to check functions....
Serial.printf("Left X:%d, Y:%d Right X:%d, Y:%d\n",LeftX, LeftY, RightX, RightY);
#endif

Joystick.X(LeftX);
Joystick.Y(LeftY);
Joystick.sliderLeft(RightX);
Joystick.sliderRight(RightY);

}

void CheckCommandButtons() {
// Command buttons are onle available if we aren't in debugging buttons
for (byte i=0; i< CMDBUTTONS; i++) {
if (digitalRead(CommandButtons) == LOW) {
Keyboard.press(CommandFunction);
delay(150);
}
else {
Keyboard.release(CommandFunction);
}
}
}

void DPad() {
// Command buttons are onle available if we aren't in debugging buttons
for (byte i=0; i< DBUTTONS; i++) {
if (digitalRead(DirectionButtons) == LOW) {
Keyboard.press(DirectionFunctions);
delay(150);
}
else {
Keyboard.release(DirectionFunctions);
}
}
}

void loop_joystick() {
int spos = 0;
if (DPad2Keys) {
spos = DBUTTONS;
DPad();
}
for (byte i=spos; i< NUMBUTTONS; i++) {
if (digitalRead(buttons[i]) == LOW) {
Joystick.button((buttons[i]+1), 1);
} else {
Joystick.button((buttons[i]+1), 0);
}
}
AnalogMove();

#ifdef USECOMMANDBUTTONS
// Check to see if their are using any command buttons
CheckCommandButtons();
#endif

}

void loop_keyboard() {
for (byte i=0; i< NUMBUTTONS; i++) {
if (digitalRead(buttons[i]) == LOW) {
Keyboard.press(keys[i]);
delay(150);
}
else {
Keyboard.release(keys[i]);
}
}
// If we want to play MAME and some others we might want to support Analog Joystick as well
AnalogMove();

#ifdef USECOMMANDBUTTONS
// Check to see if their are using any command buttons
CheckCommandButtons();
#endif

}

void loop_keyboarddebug() {
for (byte i=0; i< NUMBUTTONS; i++) {
if (digitalRead(buttons[i]) == LOW) {
Serial.println(i);
Keyboard.print(i);
delay(500); // half second delay, if you are mapping while you are running
}
else {
}
}
}

void FlashModeLED(int xTimes, int msDelay) {
#ifdef MODE_LED_USED
for (byte i=0; i< xTimes; i++) {
digitalWrite(FLASH_PIN, HIGH); // turn the LED on by making the voltage HIGH
delay(msDelay);
digitalWrite(FLASH_PIN, LOW); // turn the LED off by making the voltage LOW
delay(msDelay);
}
#endif
}

void SetButtonState() {
buttonState = digitalRead(JoyLClick);
if (buttonState != lastButtonState) {
if (buttonState == LOW) {
CurrentState = !CurrentState;
if (CurrentState) {
FlashModeLED(FLASH_JOYSTICK, FLASHDELAY_JOYSTICK);
#ifdef DEBUG_MESSAGE
Serial.println("Joystick Mode Active");
#endif
}
else {
FlashModeLED(FLASH_KEYBOARD, FLASHDELAY_KEYBOARD);
#ifdef DEBUG_MESSAGE
Serial.println("Keyboard Mode Active");
#endif
}
}
}
lastButtonState = buttonState;
}

void SetGameState() {
GameMode = digitalRead(JoyRClick);
if (GameMode != lastGameMode) {
if (GameMode == LOW) {
GameState = !GameState;
if (GameState) { // Setting N64 Mode
StickMultiplier = N64_Value;
FlashModeLED(FLASH_N64, FLASHDELAY_N64);
#ifdef DEBUG_MESSAGE
Serial.printf("N64 Mode - ");
Serial.println(StickMultiplier);
#endif
}
else { // Setting PSX Mode
StickMultiplier = PSX_Value;
FlashModeLED(FLASH_PSX, FLASHDELAY_PSX);
#ifdef DEBUG_MESSAGE
Serial.printf("PSX Mode - ");
Serial.println(StickMultiplier);
#endif
}
}
}
lastGameMode = GameMode;
}

void HomeCombo() {

for (byte i=0; i< HBUTTONS; i++) {
if (digitalRead(HomeButtons[i]) == LOW) {
Keyboard.press(HomeFunctions[i]);
delay(150);
}
else {
Keyboard.release(HomeFunctions[i]);
}
}
}

void MAMECheck() {
GameMode = digitalRead(ButStart);
if (GameMode == LOW && !DPad2Keys) {
DPad2Keys = true;
FlashModeLED(FLASH_MAME, FLASHDELAY_MAME);
#ifdef DEBUG_MESSAGE
Serial.println("MAME Mode - ON");
#endif
}
GameMode = digitalRead(ButSelect);
if (GameMode == LOW && DPad2Keys) {
DPad2Keys = false;
FlashModeLED(FLASH_NONMAME, FLASHDELAY_NONMAME);
#ifdef DEBUG_MESSAGE
Serial.println("MAME Mode - OFF");
#endif
}
LAST_DPad2Keys = DPad2Keys;
}

void loop() {

#ifdef DEBUG_BUTTONS
loop_keyboarddebug();
#else
// Power button is used to look for toggle mode. If you have the power button held down
// the teensy will look for either the left or right stick press to change modes.
// if you are not holding down power, things will work normally
tbut = digitalRead(ButPower);
int hbut = digitalRead(ButHome);

if (tbut == LOW) {
SetButtonState();
SetGameState();
MAMECheck();
}

if (hbut == LOW) {
// Enter specific keys while home button is pressed
HomeCombo();
#ifdef MODE_LED_USED
// We want to turn off the LED, it was just on.
if (LIGHT_HOME && Lasthbut != hbut) {
digitalWrite(FLASH_PIN, HIGH); // turn the LED on by making the voltage HIGH
}
Lasthbut = hbut;
#endif
}

#ifdef MODE_LED_USED
if (hbut == HIGH) {
// We want to turn off the LED, it was just on.
if (LIGHT_HOME && Lasthbut != hbut) {
digitalWrite(FLASH_PIN, LOW); // turn the LED off by making the voltage LOW
}
Lasthbut = hbut;

}
#endif

if (tbut == HIGH && hbut == HIGH) { // If either is LOW we are doing a mode change so don't call these..
if (CurrentState)
loop_joystick();
else
loop_keyboard();
}
#endif
}

User avatar
Ely
Posts: 26
Joined: Wed Aug 15, 2018 5:44 am
Has thanked: 7 times
Been thanked: 11 times

Re: WII U RASPBERRY PI 3 FINISHED

Post by Ely » Sun Feb 10, 2019 11:37 am

Nice idea to add Kite's fans to the build

User avatar
VeteranGamer
Posts: 1738
Joined: Thu Jan 26, 2017 11:12 am
Location: London, UK
Has thanked: 528 times
Been thanked: 909 times

Re: WII U RASPBERRY PI 3 FINISHED

Post by VeteranGamer » Sun Feb 10, 2019 1:12 pm

blu3rav3n wrote:
Sun Feb 10, 2019 11:12 am
Well veterangamer I cant send pm's. Not sure why but none of the pm's ive sent have gone through.
Anywho the new Teensy came in. I wired it up again but now its working slightly better then before but not completely. So the left analog stick wont recognize left or right in the button config of retro pi. Only up and down. Now the right analog sticks works 100%.

This is the code that ive been using for teensy. It matches the pin out guide on the first page so ive using that.

Im racking my brain cause i didnt do anything different but now the right analog sticks works but the left still only half works. I dont know where to go from here.


If the script/code is tried and tested....
Then I doubt that it’s the script at fault...

I’m no specialist in coding so I can’t look at it and tell you anything....

But going on from my own experience...
I would check the continuity between all the functions and the teensy...
This should include
functions to 10 pin breakout
10 pin breakout to teensy
Functions to teensy

(But for the analog sticks obviously the wiring is the first thing you check)

I personally had to get things spot on to work...
Even thou initially to me (noob eyes) I thought I had it spot on....

Especially the 10 pin breakout...
As a slightly off ribbon cable will mess things up...
Or
A pin from the ribbon connector not making firm/solid contact....


NB: if you using one of the script/codes BanjoKazooie has posted, it definitely won’t be the script....



.

User avatar
blu3rav3n
Posts: 16
Joined: Fri Dec 28, 2018 3:40 pm

Re: WII U RASPBERRY PI 3 FINISHED

Post by blu3rav3n » Sun Feb 10, 2019 1:29 pm

VeteranGamer wrote:
Sun Feb 10, 2019 1:12 pm

Checked all my connections and just resoldered everything making sure they were solidly melted and in place and it is all working now! Finally! Ill have this buttoned up and a picture of it soon. Thanks for your help and motivation VeteranGamer. Still cant believe I went through 2 of those Teensy boards....man was that not fun!

User avatar
blu3rav3n
Posts: 16
Joined: Fri Dec 28, 2018 3:40 pm

Re: WII U RASPBERRY PI 3 FINISHED

Post by blu3rav3n » Tue Feb 12, 2019 11:07 am

Well this have been one heck of an experience. I have a few small clean up spots to take care of on the inside but its done and working! Again Thanks to veterangamer and everyone here for all your help.


Image

User avatar
KonnorJ
Posts: 385
Joined: Thu Jan 11, 2018 1:23 am
Location: United Kingdom
Has thanked: 58 times
Been thanked: 109 times
Contact:

Re: WII U RASPBERRY PI 3 FINISHED

Post by KonnorJ » Tue Feb 12, 2019 1:48 pm

blu3rav3n wrote:
Tue Feb 12, 2019 11:07 am
Well this have been one heck of an experience. I have a few small clean up spots to take care of on the inside but its done and working! Again Thanks to veterangamer and everyone here for all your help.


Image
Very nice, great job

User avatar
VeteranGamer
Posts: 1738
Joined: Thu Jan 26, 2017 11:12 am
Location: London, UK
Has thanked: 528 times
Been thanked: 909 times

Re: WII U RASPBERRY PI 3 FINISHED

Post by VeteranGamer » Wed Feb 13, 2019 6:19 am

blu3rav3n wrote:
Sun Feb 10, 2019 1:29 pm
VeteranGamer wrote:
Sun Feb 10, 2019 1:12 pm

Checked all my connections and just resoldered everything making sure they were solidly melted and in place and it is all working now! Finally! Ill have this buttoned up and a picture of it soon. Thanks for your help and motivation VeteranGamer. Still cant believe I went through 2 of those Teensy boards....man was that not fun!

thats great news.....
where there's a will, there's a way


I would recommend/suggest making a build/show-off post....
there aren't that any of these builds on here...
and to also highlight your issues ad how you over came them....

it doesn't have to be super detailed....


great job any...
enjoy



.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest