Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: AVR enthuasists, I've got an idea for a project.  (Read 2975 times)

0 Members and 1 Guest are viewing this topic.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 08:33:39 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
AVR enthuasists, I've got an idea for a project.
« on: January 28, 2014, 07:28:29 pm »
Ok you know where wiimotes and accessories are a pain in the butt to connect to the pc due to Bluetooth weirdness and no official gamepad support? What if instead of plugging in the Bluetooth dongle directly, the dongle gets plugged into a usb enabled avr.

The avr would handle the Bluetooth communication and pairing (eliminating the issue where wiimote pair codes can't be passed via most Bluetooth stacks).  On the pc end of things it would show up as a HID mouse and gamepad and perhaps serial communication could be used to set the different modes. (What the accelerometer controls, the ir mode, ect)

I don't have a lot of experience with complex avr projects.  Is this too complex a project?  Do any of you guys think you can pull it off?

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
Re: AVR enthuasists, I've got an idea for a project.
« Reply #1 on: January 29, 2014, 01:28:00 am »
http://www.circuitsathome.com/mcu/ps3-and-wiimote-game-controllers-on-the-arduino-host-shield-part-1

There are others too. A few Youtube videos here and there. Just take a peek around.

I don't particularly like the Arduino but that is an option for some.  Personally I would explore the AT90USB1287 and *647 which may work. They have OTG capabilities and you might be able to extend that to support a dongle. Or move onto the ARM controllers to do the heavy lifting. I don't belive Atmel's 32-bit line is going to be anywhere near as successful as the 8-bit AVR's.

I think it can be done if given the right combination of hardware. For instance, don't bother with a 32U4 and a Windows Bluetooth dongle. You're just going to waste time. But if you can find a daughter card that allows you to communicate via the USART or some other means and not appear as COM port, then it's doable. In the link above, they used a MAXIM part to handle the USB host communication to the dongle.

As an added bonus, TWI is often on seperate pins meaning you can have an adapter to directly interface to the Wii accessories without a Wiimote. eg, like the classic controller. (Do they still sell that anymore?)
« Last Edit: January 29, 2014, 01:35:48 am by SavannahLion »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 08:33:39 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: AVR enthuasists, I've got an idea for a project.
« Reply #2 on: January 29, 2014, 02:19:25 am »
Thanks for the info.  I'm not really fond of arduino boards either, mostly for cost reasons.  If your avr and corresponding add-ons required to give it the proper functionality cost upwards of 100 bucks then it would be easier and cheaper to commission a custom pcb. 

I know the teensy is only 20 bucks and has built-in usb functionality... I've made some hid joysticks with them.  So that's 1/3 of the problem solved.  The Bluetooth interface would be the other thing, but my guess is there is a library for that somewhere.  The last 3rd would be the tricky bit, namely taking the raw IR data and converting it to mouse/joystick movement at the avr level and doing something with the motion sensors, like maybe a "shake button" or something.

It would be nice if we could make a dongle that works with a readily available Bluetooth dongle and have it offered at a reasonable price. 

This sort of thing isn't a huge issue now, but I think it might be in the future.  When the Wii/Wii U becomes so old that most people only play it on emulators an easy interface for the controllers is going to be needed as wii games just don't play right on a standard controller.  Right now the protocols are well documented, but that stuff tends to get lost as time marches on.

ark_ader

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5645
  • Last login:March 02, 2019, 07:35:34 pm
  • I glow in the dark.
Re: AVR enthuasists, I've got an idea for a project.
« Reply #3 on: January 29, 2014, 04:01:15 am »
I find that the wii motes (I have 5 of them) work very well with the pc and android.  Also you might want to check out Cronus, as it allows you to connect all sorts PC/360/Wii/PS3 devices off a standard BT dongle, with mapping via the PC.  $50 is cheap enough as a solution than farting about with AVRs.
If I had only one wish, it would be for three more wishes.

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
Re: AVR enthuasists, I've got an idea for a project.
« Reply #4 on: January 29, 2014, 04:11:54 am »
Howard, that was only one solution. Culled from my AVR library. No I don't use Arduino, but there are times I'll use the shields.

Anyways.....

I wrote this big ass post with all sorts of hardware combinations but Ark kind of beat me to it. Cronus kind of knocks all the ideas out of the water.

However, if you're just in it for the experience. I calculate the hardware costs to be somewhere in the range of $50 using "pre-made" components. If you're willing to ditch the AVR and go with more capable solutions, I can guarantee you can get the pre-fabbed hardware you need under $20. Less if you already have the BT dongle on hand.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9269
  • Last login:Yesterday at 09:09:57 am
  • ...
Re: AVR enthuasists, I've got an idea for a project.
« Reply #5 on: January 29, 2014, 09:19:36 am »
I find that the wii motes (I have 5 of them) work very well with the pc and android.  Also you might want to check out Cronus, as it allows you to connect all sorts PC/360/Wii/PS3 devices off a standard BT dongle, with mapping via the PC.  $50 is cheap enough as a solution than farting about with AVRs.

Thanks for mentioning the Cronus.  I hadn't heard of it before.  (repped, lol)
It doesn't seem to be available on the manufacturer's site or Amazon (their listed US distributor) which is a bit concerning,
but I ordered one off an ebay seller anyway for $55 shipped.

I have some sweet looking 3rd party wii guns that I haven't been able to get to link consistently enough to incorporate into the cab.
(and I get a BSOD when connecting the second gun)
Hopefully this turns out to be a workaround.

EDIT: Can't seem to find any info on if it maintains the pairing after power down.  Guess we'll see when it arrives.
« Last Edit: January 29, 2014, 10:08:10 am by BadMouth »

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9269
  • Last login:Yesterday at 09:09:57 am
  • ...
Re: AVR enthuasists, I've got an idea for a project.
« Reply #6 on: January 29, 2014, 10:42:59 am »
It appears the original Cronus device is defunct and has been replaced by CronusMax
http://cronusmax.com/

An amazon reviewer states that it is a different development team and complete rewrite of the firmware.
Now I wish I would have purchased the current one.  Should have done my homework first.  :-\

Sounds like it's the same board anyway and is upgradeable:
http://cronusmax.com/who-are-cronusmax/
« Last Edit: January 29, 2014, 10:52:09 am by BadMouth »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 08:33:39 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: AVR enthuasists, I've got an idea for a project.
« Reply #7 on: January 29, 2014, 01:13:06 pm »
I can't seem to find a lot of info on it.  The website mentions the 360 and Ps3 a lot but not the Wii.  The only real thing to infer that it works on Wiimotes is the picture of a wiimote at the bottom of the page. 

50 would be more than reasonable, but is this a deal where I have to buy one for each controller, or will it work with 4 wiimotes?

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9269
  • Last login:Yesterday at 09:09:57 am
  • ...
Re: AVR enthuasists, I've got an idea for a project.
« Reply #8 on: January 29, 2014, 01:44:27 pm »
I can't seem to find a lot of info on it.  The website mentions the 360 and Ps3 a lot but not the Wii.  The only real thing to infer that it works on Wiimotes is the picture of a wiimote at the bottom of the page. 

50 would be more than reasonable, but is this a deal where I have to buy one for each controller, or will it work with 4 wiimotes?

In digging in the forums, I came across a post from the devs that they plan to release new firmware this year that will support more than one Bluetooth input device simultaneously.  No clue whether that means just two or possibly more.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 08:33:39 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: AVR enthuasists, I've got an idea for a project.
« Reply #9 on: January 29, 2014, 01:56:04 pm »
Realistically 2 is enough, I don't exactly see a lot of 4 player lightgun games, but I never know what I might want to do in the future. 

There are Chinese knock-offs of wiimotes for as little as 5-10 dollars. I picked a couple up just for the heck of it and while the buttons and ect are definitely of an inferior quality the internal components seem to work identically, including the ir camera.  So if you want to make a custom lightgun or whatever you could make as many as you want for peanuts.  Even without that, the wiimote is the cheapest multi-sensor array on the market.  It's good for general-purpose hackery.

ark_ader

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5645
  • Last login:March 02, 2019, 07:35:34 pm
  • I glow in the dark.
Re: AVR enthuasists, I've got an idea for a project.
« Reply #10 on: January 29, 2014, 02:27:28 pm »
Also you can link to a PC via USB and have true keyboard and mouse for the Xbox 360 and ps3 (I haven't tried wii yet) which I can confirm that it works brilliantly.

If I had only one wish, it would be for three more wishes.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9269
  • Last login:Yesterday at 09:09:57 am
  • ...
Re: AVR enthuasists, I've got an idea for a project.
« Reply #11 on: February 02, 2014, 05:34:44 pm »
Played around with the original Cronus device for a bit today.
For PC use it is detected as an xbox360 controller.
The IR camera XY can be mapped to an analog stick XY on the virtual xbox360 controller.

Pairing does go a lot better than it did trying to connect to the PC directly.
After disconnecting and reconnecting the Cronus device it will just keep searching until the gun is turned on, so the gun doesn't need turned on until it's ready to use.
It always connects on the second try.  Not perfect, but predictable and I don't have to touch anything on the cronus or the PC, only the wii controller.
I press connect the first time and all the blue lights flash for a while (and it doesn't connect), then I hit it a second time and the lights blink a couple times then go off..meaning it's connected.

While that part is good enough, I haven't been able to get the performance anywhere near where it needs to be for a light gun.
The virtual stick movement follows along fine when making slow deliberate movements, but aim at different areas of the screen quickly and it seems to lose track of where the gun is pointed quickly, then catches up a half second later. 

I suppose it could have been the wii gun, or IR bar, or ambient light, but the performance of Howard's glovepie scripts performed much better (when tested in the past).
I will experiment some more when I get time.

It's obvious from using the setup software that the primary focus of this device is for console use and the wii controller as a gun is somewhat of an afterthought though.
I'm not sure if the CronusMax firmware would be better.  I wish I hadn't bought the old version.

IMO, there's still room for a dedicated device to making wii guns connect and perform well on a PC.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 08:33:39 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: AVR enthuasists, I've got an idea for a project.
« Reply #12 on: February 02, 2014, 05:56:08 pm »
Shoot, we are back to the drawing board then.  My guess is the max version isn't much better.  They've all but abandoned any mention of the wiimote in their current marketing pitch.

Here's the thing... I can do wonders with glovepie, BUT glovepie is a dead project and nobody has stepped up to make a replacement.  Now maybe we could get a driver wizard like Headkaze to write us a driver for the wiimote using existing Bluetooth connections, but the way windows works now, without a proper digital signature it could be a pain in the butt installing it.  Even then you'd pretty much need a Bluetooth stack written to auto pair with devices without codes or have the ability to use codes with "0x00" in them. 

The Wiimote is an odd little device.  It has a square camera resolution if I'm not mistaken.  This isn't uncommon for pc lightguns either, but the fact that the sensor bar placement means that parts of the visible area could be outside the screen tends to foul things up a bit.  So you have to do all kinds of compensation, and rounding and stuff, you can't just hook up the pointer position to a joystick.  Glove pie did a really good job of that.  I don't know how much we could replicate via an AVR.


But as far as that is concerned a wiimote shows up on the pc as a serial device basically.  I haven't played extensively with input polling, but I know writing to it (for mamehooker) is quite easy.  So perhaps some future-proofed software could be written. 

The main issue is the connection problems with Bluetooth stacks.  So we really need a custom Bluetooth radio more than anything. 

Goglu2

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:January 05, 2023, 07:57:19 am
  • I want to build my own arcade controls!
Re: AVR enthuasists, I've got an idea for a project.
« Reply #13 on: February 02, 2014, 06:05:24 pm »
Might not be what your looking for http://www.adafruit.com/products/1588

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 08:33:39 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: AVR enthuasists, I've got an idea for a project.
« Reply #14 on: February 02, 2014, 06:25:33 pm »
Well that's just a serial port.  afaik.  The wiimote does indeed show up as an individual device in windows and while you communicate to it via a serial connection it's a HID device, not  a plain old serial port. 

It might be possible to use something like that, but all connections, including the entire Bluetooth protocol would have to be emulated on the pc.  So it probably wouldn't be an ideal solution. 

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
Re: AVR enthuasists, I've got an idea for a project.
« Reply #15 on: February 02, 2014, 08:41:09 pm »
The BTStack project might hold a solution for you. It can compile and run without an RTOS and, apparently, can operate on the larger AVR's like the 2561. Its originally targeted for the MP430 platform though, of which the starter kit can be had for 10 bones. I'm not entirely sure if there is a USB controller somewhere on the MP430 chip. As much as I love my 16-bit consoles, I don't find the 16 bit MCU's very interesting so I don't pay too much attention to them.

For four extra Washingtons, look under the hood at the STM32F4DISCOVERY. Digikey has them for sale.. There are few other 32 bit dual USB controllers out there you can consider. That would let you use your El-Cheapo dongles. Unfortunately, I have not bothered to look into whether there was anything like LUFA or BTStack for the 23-bit chips.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9269
  • Last login:Yesterday at 09:09:57 am
  • ...
Re: AVR enthuasists, I've got an idea for a project.
« Reply #16 on: February 04, 2014, 06:55:22 pm »
Have you seen Aganyte's Gun2NAOMI (and PC) project?
http://forum.arcadecontrols.com/index.php/topic,132218.msg1357930.html#msg1357930

It's over my head, but he somehow uses a wii camera.


BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9269
  • Last login:Yesterday at 09:09:57 am
  • ...
Re: AVR enthuasists, I've got an idea for a project.
« Reply #17 on: February 04, 2014, 07:08:50 pm »
This is an old article, but I hadn't seen it before:
http://www.richlynch.com/2009/11/18/permanently-pair-wiimotewii-balance-board/

In another thread, someone mentioned a program called wiipair.
That guy is the author.
Seems to be working for people emulating the wii with dolphin.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 08:33:39 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: AVR enthuasists, I've got an idea for a project.
« Reply #18 on: February 04, 2014, 07:48:09 pm »
That's a pretty snazzie bit of code.  I've found very few Bluetooth software examples, so this might be enough to fix the issue. 

I'll mess with it tomorrow.  Honestly though I don't know why this would be balance board specific. 

From every bit of documentation I've read the balance board shows up as a wiimote, with the pressure sensors controlling an "ir camera" position and the sync button acting as the A button.  Nintendo wanted to make interfacing as painless as possible so everything shows up as either a wiimote, nunchuck or classic controller, with the last two just being minor variants of each other.

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
Re: AVR enthuasists, I've got an idea for a project.
« Reply #19 on: February 04, 2014, 07:56:52 pm »
That's interesting. Didn't I read somewhere that the Wii only allows one balance board to be synched at a time?

Oh wait... the board lacks any indicator leds right? That must be why....

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 08:33:39 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: AVR enthuasists, I've got an idea for a project.
« Reply #20 on: February 04, 2014, 10:02:08 pm »
Yean it's more of a Wii policy thing than anything else.  Although I do think that on the Wii the BB sync slot is hardcoded to slot #5... I don't know if that's a software thing or an OS thing or what. 

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
Re: AVR enthuasists, I've got an idea for a project.
« Reply #21 on: February 05, 2014, 12:33:44 am »
Although I do think that on the Wii the BB sync slot is hardcoded to slot #5...

It would have to be. Without indicator lights, your average player wouldn't know whose board belongs to whom.

rpgposer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 161
  • Last login:August 31, 2018, 11:46:12 am
  • PSO lover.
Re: AVR enthuasists, I've got an idea for a project.
« Reply #22 on: February 06, 2014, 11:29:07 am »
This may be of interest:  http://touchmote.net/.  I assume that it won't help the BT stack issues, but it does appear to be some sort of replacement for glovepie.  Sigh, once again, another cool thing I don't have the time to check out.
Never met a game I won't keep.