New Flowcode Wii nunchuck component.

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9100
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

New Flowcode Wii nunchuck component.

Post by medelec35 »

The nunchuck controller has been added to Flowcode v8 components.
You will need to use Help, check for updates after loaded the attached file.
Finish by selecting the Reload icon.

Wii nunchuck has the following features:
• Standard I2C interface.
• 3-axis accelerometer with. 10-bit accuracy.
• 2-axis analog joystick with. 8-bit A/D converter.
• 2 buttons
I have just created a nunchuk tester, so you can see if all is working or not.

Hardware:
Nintendo Wii knunchuck controller
Keyes1 Wii chuck Kduino1 PCB adaptor for plugging in to nunchuck connector.
BL0080 Eblocks2 PIC multiprogrammer with PIC16F18877.
BL0169 Eblocks2 Alphanumeric LCD board 20x4 plugged in to D port of PIC multiprogrammer.
Solderless breadboard for PCB adaptor.
BL0161 Eblocks2 patch board plugged in to C port of PIC multiprogrammer.
DuPont jumper leads.
Of course this should work with any hardware as also tested with Arduino UNO.

PCB adaptor connections.
- to GND of PIC multiprogrammer.
+ to 3V3 of PIC multiprogrammer. Warning: Do not connect to 5V.
d to 0 of patch board (d = SDA).
c to 1 patch board (c = SCL).

Only the genuine nunchuck has currently been tested.
Will test the very cheap version (ranging from £2 on wards) as soon as received them.

When running the hardware, if all is working you should see this:
LCD 20x4 nun1.png
LCD 20x4 nun1.png (136.52 KiB) Viewed 947 times
Of course values will depend on the the orientation, joy position and if buttons pressed or not.
I will be easy to add LED's that change brighness and flashing rate by using accelerometer & joystick etc.

The 4x20 LCD can easily be swapped with UART component.

Let me know if you try this and face any issues.
Attachments
Nunchucks 16F18877 LCD v1.1.fcfx
(18.38 KiB) Downloaded 20 times
Martin

mnf
Valued Contributor
Valued Contributor
Posts: 929
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: New Flowcode Wii nunchuck component.

Post by mnf »

Thanks. That looks very cool.. A trip to the loft/charity shop to try and find a set....

Martin

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9100
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: New Flowcode Wii nunchuck component.

Post by medelec35 »

Hi Martin, thank you.
I was thinking of getting a nunchucker controller, removing PCB & just making an electronic sprint level that works in X and Y directions.
Just ordered 2 for £9.99, but also read you can get them from the pound stores.
Martin

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9100
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: New Flowcode Wii nunchuck component.

Post by medelec35 »

Good new is budget Chinese wii nunchucks arrived today.
All working as expected.
Its easier to remove PCB and cable if required, since it uses philips screws.
Original Nintendo uses triwing screws.
Martin

stefan.erni
Posts: 617
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Contact:

Re: New Flowcode Wii nunchuck component.

Post by stefan.erni »

Hi Martin

It's a nice idea to use the wii nunchuck.
To connect it's also simple. I just shoped a small print.
I changed few line for an another display and it's working fine (in software mode) with the both switch
but not with the Accelerometer and Joystick. In the simulation everything looks fine.
Maybe it's more a PIC32 I2C problem.

regards
Stefan

Adapter.PNG
Adapter.PNG (242.65 KiB) Viewed 857 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9100
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: New Flowcode Wii nunchuck component.

Post by medelec35 »

Hi Stefan,
Yes, they are cheap and have uses.
Can you post your Flowchart and I will see if I can spot any thing?
Have you done the usual 1 second flash test?
What happens with I2C in hardware mode?
Martin

stefan.erni
Posts: 617
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Contact:

Re: New Flowcode Wii nunchuck component.

Post by stefan.erni »

Hi Martin

Yes the flashtest is ok.

I2C softwaremode:
The two switch are working. If I press one, the first and second value change from 0 to 1. The 3 Axis from Accelerometer are always -512 and the Joystick always 0.

I2C hardwaremode:
There is no clock on the SCL pin.

regards

Stefan
Flip-and_Click_Pic32efh100-display_D_Wii_A.fcfx
(52.38 KiB) Downloaded 14 times
Wii-1.jpg
Wii-1.jpg (151.31 KiB) Viewed 820 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9100
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: New Flowcode Wii nunchuck component.

Post by medelec35 »

I can't spot any issues.
stefan.erni wrote:
Tue Sep 01, 2020 6:12 pm
Maybe it's more a PIC32 I2C problem.
Yes I agree.
Do you have an analyser to confirm I2C values?
Unfortunately I don't have your target device, so unable confirm data myself.

Perhaps someone at matrix would be able to check I2C out?
Martin

User avatar
Benj
Matrix Staff
Posts: 15009
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: New Flowcode Wii nunchuck component.

Post by Benj »

I'll look into the hardware I2C issue on the MZ devices and see if I can find anything.

Maybe try the Nunchuk component with the encryption property set to yes and see if that gives you any better results?

stefan.erni
Posts: 617
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Contact:

Re: New Flowcode Wii nunchuck component.

Post by stefan.erni »

Hi Ben, Hi Martin

Is it possible to post where to shop working cheap Nunchuck?

There is a problem with hardware I2C and PIC32MZ.
But just in the 100khz and custom mode.
The 400kHz and 1Mhz are working in hardwaremode with the nunchuck.
The software mode is not working for the nunchuck Accelerometer and Joystick but the two switch are working nice.

regards

Stefan
wii-ok.jpg
wii-ok.jpg (160.38 KiB) Viewed 766 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9100
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: New Flowcode Wii nunchuck component.

Post by medelec35 »

Hi Stefan,
At least nunchucks are working now which is great news.
stefan.erni wrote:
Thu Sep 03, 2020 9:02 am
Is it possible to post where to shop working cheap Nunchuck?
Here's a link to the ones I bought which work fine for me.
Martin

stefan.erni
Posts: 617
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Contact:

Re: New Flowcode Wii nunchuck component.

Post by stefan.erni »

Hi Martin

Thank you for the info.
Yes the nunchuck is working very nice and stable.
regards

Stefan

Post Reply