Gamasutra: The Art & Business of Making Gamesspacer
Making the Wireless Digital Katana – Hardware Development in Australia
Printer-Friendly VersionPrinter-Friendly Version
View All     RSS
April 21, 2014
arrowPress Releases
April 21, 2014
PR Newswire
View All





If you enjoy reading this site, you might also want to check out these UBM TechWeb sites:


 
Making the Wireless Digital Katana – Hardware Development in Australia
by Paul Taylor on 11/13/13 07:23:00 pm   Featured Blogs

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

 

My name is Paul Taylor; I am a Systems Engineer living down in Australia. When I’m not riding Kangaroos or swatting flies, I’ve been developing a Wireless Digital Katana. In essence it is a very high-speed, high-accuracy motion sensitive input device. Right now I am running a Kickstarter campaign to fund my project into the real-world, interestingly it began months ago when another person’s Kickstarter failed to deliver.

The seed is planted…

June 2012 I saw the video on the Clang Kickstarter campaign (it’s amazingly well done, you should check it out www.kickstarter.com/projects/260688528/clang) at one point in that video they demonstrated a digital sword controller and I fell in love. I watched the project evolve, unfortunately backer discontent rose, the project slipped behind and it became clear that the sword controller was not going to eventuate through their campaign. It was that moment that I decided to make a great sword motion controller happen.

Prototyping like a boss…

My work started like all great things, with the Internet. Had this been done before? Had it been done well? How should I approach it? The answers were simple: Beyond plastic adaptors for Wii Remote controllers, the sword controller did not exist.

I decided on two components for the next step: Motion Sensors and a Microcontroller to get the signals from the sensors to the PC.

Some more internet research and I knew that I would be using an Arduino microcontroller at the heart of the Digital Katana (the sword became a Katana (Japanese Sword), as it is the type that I train with (in Iaido) and have the most appreciation for).

Arduino microcontrollers are Open-Hardware, have a huge community and are both powerful and relatively simple to program, I grabbed one off my desk for the first iteration (it is HUGE) way too big to be practical, but had enough room to debug the ugliest programming problems. My research into motion sensors found many great sensors that work with Arduino microcontrollers, however I settled on the only all-in-one 9-axis motion sensor. In the space of 4x4x1mm this tiny device can track acceleration (gravity and motion), magnetism (think of a 3D compass), and rotation (via on-board gyroscopes). To buy these parts in Australia turned out to be impossible, there are two major factors which make Australia so remote, slow postage and the ‘Australia Tax’.

Living in Australia has some perks (great surfing, lots of space, cultures from every part of the globe) and a mythical beast I refer to as the ‘Australia Tax’, it is the huge price increases artificially put on products sold here (You’ll see in recent and old media companies including Adobe, Microsoft and Sony defending these blatant rip-offs).

I quickly jumped on eBay and found some samples to test, then waited…. It would be 2-4 weeks before I could progress on the electronic components of my project, so I used my most valuable Wild-Card for prototyping: Guesstimation (I know it is not a word, I’m making it a word). Taking educated guesses at where my project would lead I began pre-ordering all types of hardware: Various wireless modules, Batteries, connectors, Arduino boards. All up I spent less than $100AU on these guesstimated parts.

Locally I purchased a bokken (wooden practice katana) and some tools to help modify it.

Fast-forward a couple of weeks and enough hardware arrived for me to assemble the first prototype. It was an ugly pile of wires that would spit out huge quantities of text via a serial connection to a text box on my PC, if you poked the pile of wires the numbers would change. From the outside not exactly exciting, but to see my creation alive, even just barely was exhilarating and super-motivating.

24 hours later I had cut and drilled the bokken, attached the sensors, Zip-Tied the amazingly huge Arduino to the side and was swinging my wooden katana (now a digital katana) around with that huge text stream pouring onto the PC screen.

Now that the controller was alive, it was time to work on the software that would realise the serial text stream into something more tangible. I’ve done a lot of video game programming, so it was only a weekend of work to create the first 3D interactive simulation of the digital katana. You can see lots of pretty graphs and debug text, this was really helpful, especially as some of the Axis and rotations were initially backwards.

Development could now continue in 3 Dimensions, and it became clear that is some situations the motion sensor would get weird, really weird. The tracking would be great one minute, and jumping all over the place snapping about the next. Testing showed that the sensors have a few orientations where behaviour is less than ideal. I solved this by adding a second sensor to the tip of the Digital Katana, giving me the luxury of reading from either sensor and even mixing data from both sensors. The result has been a dramatic improvement in tracking and reliability, no longer did I have to put up with weird motion tracking.

The following Monday a pair of Wireless transceivers appeared in the mail box (I ordered these weeks prior), so I was able to start working on creating a Wireless link. I avoided using a Wi-Fi (Wireless Network) module, instead opting for a more direct approach, utilising a wireless link directly between the PC and the Digital Katana. Two days of tears and I was unable to get the wireless link happening, looking through the schematics provided by the chip manufacturer I was able to identify a missing capacitor on my wireless units.

Simply adding one of these little guys to each unit had my wireless transmission operational. Unlike traditional Wi-Fi which can take huge quantities of data, the direct link is only capable of transmitting 32 bytes of data in each packet (transmission). Packing the information from a 9-axis motion sensor into a group of just 256 1’s and 0’s was a mathematical adventure. I won’t bore you with the details (contact me if you’re dying to know), suffice to say I succeeded and was able to evolve the Digital Katana into the Wireless Digital Katana.

Finding an Arduino that would be compact enough to fit inside of the wooden bokken, yet powerful enough to perform all of the required computation was the next challenge I had to overcome. There were three contenders:

Arduino Pro Mini, 3.3v 8Mhz

Arduino Pro Mini, 5v, 16Mhz

Arduino Nano V3, 5v, 16Mhz

All of these had only 32KB of code storage (the giant Arduino Mega has a whopping 256kB of storage), so a lot of time was spent optimising my code which was initially 120kB down to 32kB. It involved a lot of late nights and coffee to devise code that was smarter and thus smaller.

With the code shrunk I was able to start testing Arduino the boards. The 3.3v 8 MHz Pro Mini was too slow, it could keep up some of the time, so I filed it into the not-so-great ideas basket. Both the other Arduinos were easily fast enough for the job. The 5v Arduino Nano is 10mm longer and a little higher due to the USB plug, but was my final solution as it means anyone tinkering with the Wireless Digital Katana can easily update the processor software, if I had used the smaller Pro Mini updating the software would require specialised hardware (an FTDI programmer).

With the 5v solution required on the Wireless Digital Katana, I needed to find a power solution that could supply a continuous voltage of 5v to the device for at least 1 – 2 hours. The most dense (capacity for size) rechargeable batteries that were common enough to consider were the Lithium-Polymer and Lithium-Ion types. This resulted in another eBay splurge, ordering quite a few different Li-Po and Li-Ion batteries along with various USB chargers.

Testing yielded that a type 1400 Li-Ion battery (the same size as a AA battery) contained more than enough power for the Digital Wireless Katana, and I was able to drill a hole in the base of the Katana to subtly contain the battery. Any engineers reading this article will already be screaming “but a 1400 Li-Ion is only 3.7v and your circuit needs 5v!”, and they are in fact correct. The solution was to either move to 2x batteries (more weight and charging difficulties) or utilise a tiny step-up converter.

Since the rapid growth in USB portable devices, and subsequent rapid growth in portable charging solutions, the cost of DC-DC step up converters which output 5v have plummeted. What would have cost 10s of dollars 2 years ago is now available for less than $2.

This solved my voltage issues with a small (8%) power usage overhead.

Designing the receiver was actually very simple, it utilises the same Arduino Nano board as the Wireless Digital Katana, yet performs less work, simply receiving packets from the Katana and passing these on to the host PC. I’m currently using 3D printing to design a compact and elegant case for the receiver.

Taking my project from a really cool prototype to a Kickstarter campaign (http://www.kickstarter.com/projects/511679941/open-source-digital-katana-with-real-time-tracking) was one of the last challenges.

  • Sourcing components in bulk
  • Calculating international shipping
  • Filming a video.
  • Documenting processes and timelines.

These are just some of the tasks that you’ll never need to face if you are designing things at home. Moving my project into the public space has been a massive change in demands.

So if you’re a budding engineer or tinkerer, learn to love eBay, dream big, and have fun!

 


Related Jobs

Piranha Games Inc
Piranha Games Inc — Vancouver, British Columbia, Canada
[04.20.14]

Network Engineer
FableLabs
FableLabs — San Francisco, California, United States
[04.20.14]

Senior Tools Developer (C#, Unity3D)
FableLabs
FableLabs — San Francisco, California, United States
[04.20.14]

Senior Gameplay Developer (Unity3D, C#)
Activision Publishing
Activision Publishing — Vancouver, British Columbia, Canada
[04.19.14]

Principal Graphics Programmer






Comments


Gidi van Liempd
profile image
First of, great article! I love how you describe all your efforts.
I have some experience with creating a "digital lightsaber" (http://www.youtube.com/watch?v=Eo1z4b3-DZ4), so I can appreciate the effort.
I have a few questions/remarks:
1] Do you have positional tracking as well as rotational tracking (how to detect if the sword is above the head?), or what is your goal?
2] What do you think the reason is for the "motion sensor gets really weird"?
3] What motion update rate (messages/sec) and lag time are you aiming for (and why?)
4] You say the step-up converter has only an 8% extra power usage. For another wireless project I looked at the NCP1402-3.3V step-up converter. While it is "doing its work", I never get the efficiency as promised in the data sheets when I measure the actual current. (So I finally decided to use a 3.7V LiPo battery and a MCP1825 voltage regulator, since that has only a .2 V drop, and works excellent with the Teensy2.0 I am using). My project runs excellent at 8 MHz, but perhaps I do not need the motion update rate why you need 16 MHz?

Paul Taylor
profile image
Heya Gidi, Thank you for the comment and your video rocks!

1] Positional tracking is loose but functional, my core focus has been on the speed of the blade, making sure that correct cutting motion is discernable from slow and sloppy cuts.

2] I'm 99% certain it is to do with linear interpolation as multiple axis cross their origins. I'm tinkering with some quaternion based solutions ATM (4D space, horrible, horrible maths, beautiful results). Currently I monitor for these anomolies and utilise the other sensor module to keep traking under control.

3] Currently I'm taking 25 samples a second from each sensor, with a total of 50 samples a second. This gives me a 40ms interval between each reading on a sensor, and 20ms per message that I need to transmit back to the host. Basically I'm aiming for as fast as I can without putting the Arduino into a state where messages bank up (this would increase lag a lot).

4] I've not actually tested the efficiency, as I'm using Li-Ion batteries with over 1000mah, even at a lower efficiency I will get hours from the Digital Katana.
As for the processing speed, at 16mhz I'm able to track 2x motion sensors at high polling rates.
I've got a bit more work to do assembling the 32byte packets and sending them on to the reciever (the RF transmitter uses a SPI interface, complicated but fast), if you're interested I can help you get Wireless up on your lightsaber too.
The faster I can poll and track motion, the better this device is for Iaido training (Japanese Sword-Drawing & Cutting), experts in this move the blade at terrifying speeds.

Keep up the hacking!
-Paul

Aleksander Adamkiewicz
profile image
Does it work with Blade Symphony?

No seriously, does it work with Blade Symphony?

Paul Taylor
profile image
That would be an amazing result, but there are many adventures to be had between what the hardware does, and what Blade Symphony expects as input. It's not impossible, but a lot of work would be needed.

David Paris
profile image
Nice technical work. I applaud your efforts!

My main concern with a virtual katana, is that it is very hard to picture making use of it in a household. It takes quite a bit of space to use the katana normally, particularly with the range of positions you are likely to want to be able to simulate. I don't think my house is really up to the challenge :)

Paul Taylor
profile image
Hi David,

Thanks for the reply, I agree that a lot of rooms will not suit it, but there are already a lot of motion controllers out there that are 'sword-like'. My intention was for it to be weighted correctly, and that is only possible with a full size Katana. :-)


none
 
Comment: