LoginLogin

Transfer Files from the 3DS to PC Using a Webcam

Root / Talk About Programs / [.]

amihartCreated:
I wrote a program that can transfer a file to the PC using a webcam. You simply hold the 3DS up to the webcam while it's sending the file. It sends at a mind-blowing... 1 byte per second! xD That's at best! You might be able to get this to even go faster, but you'd probably need a darn good webcam. My built-in laptop one is the one I'm working with. Here's a video of it in action: https://www.youtube.com/watch?v=RNybUsJg974 The video is of me holding the 3DS up to the webcam and sending the message "Hello, world!". The PC "receiver" I'm using is some code I wrote in JSFiddle. You can use that here: https://jsfiddle.net/amihart/refy4t7e/show/ I will upload the SmileBASIC "sender" tomorrow. But if you're curious to how the code works, I'll explain it. It's pretty simple. It uses three colors and white to send the message. RGB, that's the easiest three colors for a camera to pick up, and white when it's not clear if it's R, G, or B. These colors flash across the screen very quickly, and each flash is 1 bit. When you start the "receiver", it will wait until the color it's receiving changes from white to something else before it logs the bit. The "sender" reads the file and encodes it into the correct colors, then flashes them across the screen. No color corresponds to a 0 or a 1. What determines 0s or 1s is where they fall in sequence. If the color is red and it changes to a blue, that's a 1. But if it's red and it changes to a green, that's a 0. If a blue changes to a green, that's a 1. Whether the current displayed color is R, G, or B, you always have two places to change to. R can change to G or B, G can change to R or B, and B can change to G or R. That's two possibilities for each, meaning a 0 or a 1. And that's how the data is encoded. It starts on white, and ends on white. The "receiver" side will first assume that the color is white, then will begin receiving. It will read the color and if it's still white, it does nothing. Once it changes, it logs the change, and stores a 0 or a 1 depending on the rules. Only changes matter, so if it receives a red and receives a red 1 millisecond later, it just discards that. It keeps receiving until it gets something different from red, then it determines whether or not that means a 0 or a 1 and stores that for future decoding. Once it receives white a second time, it knows the message has finished. Because of this, you don't need a clock or anything. The bitrate can be adjusted at the sender's side and as long as you have a webcam that can keep up, it won't affect the receiver's side. Anyways, sorry if this is a poor explanation. Here is the "protocol" I am using for this, it explains how to encode and decode data by color: http://pastebin.com/raw/8NZpbaL5 The JSFiddle is actually so generic that any device could send messages to it as long as it follows that protocol. I had this idea because I did something using the same message-sending logic before. I wrote a program for the TI-83/4 graphing calculators to send data over the 2.5mm TRS cables. That used voltage rather than color but the concept is exactly the same. You can see that here: https://www.cemetech.net/forum/viewtopic.php?t=9906 This definitely is not an alternative to something like PetitModem. PetitModem the two devices talk back and forth to each other and it has great error correction. For this one, the 3DS just spits out all the data and hopes the PC can catch it all. Any interference can distort your message. You can adjust the bitrate to be less than 8 bits per second if your camera is too slow to keep up with it.

This is fascinating, and a clever solution. I was thinking it could be useful to transfer programs via QR codes, but they can't contain enough to be useful. I'd have to generate a bunch in sequence, but this would do the trick just fine.

This is fascinating, and a clever solution. I was thinking it could be useful to transfer programs via QR codes, but they can't contain enough to be useful. I'd have to generate a bunch in sequence, but this would do the trick just fine.
*ptsd triggers*

That's pretty brilliant, doon't suppose it would be too much of a stretch to divide it up into multiple colored blocks to get the speed up. Sure it would never be fast, but it getting a few bytes per second doesn't seem entirely impossible.

I uploaded the PC "receiver" to the Chrome Web store here. This way you can actually install it and use it offline, and it's compatible with Windows, Linux, and Mac. I uploaded the SmileBASIC "sender" too, the public key is DK28QJ4F.

Can someone try it out and tell me if it works for you? Also, the bitrate can be adjusted anywhere between 0.25 and 8 (8 = 1 byte per second). If your camera has a really low FPS, try turning the bitrate down. My webcam can do 8 bps reliably pretty easily, although I have a cheaper USB one that can only do 2 bps reliably. If you are unsure how to work the program, here's the steps on how to do it. 1. Load the program on the 3DS. 2. Select your file you want to transfer (it comes with a file called SENDME). 3. Select your bitrate with the up/down arrows. 4. The screen should be white and read "0%". 5. Load the program on the PC. 4. Place the 3DS screen in front of the webcam (the closer the better, I place my directly on the webcam). 5. Click the "Receive Message" button on the PC app. 6. Press "A" on the 3DS. 7. Wait until the program finishes and the PC app tells you it received the message. Don't do steps 5 and 6 simultaneously. Step 5 should come before step 6, maybe wait like 2 seconds in between those two steps. You want the computer side to receive the message as "white" first before you start sending the message on the 3DS.

I'll try to give this a try over the weekend. I'm unable to do anything today though. Just PM me if I forget.

This is fascinating, and a clever solution. I was thinking it could be useful to transfer programs via QR codes, but they can't contain enough to be useful. I'd have to generate a bunch in sequence, but this would do the trick just fine.
*ptsd triggers*
From what? QR codes? I mean, I kinda miss them too, but they were really bothersome to scan.

I gave this a try, at least I think this is the same as the program you just published. It looked like it was doing something, but I couldn't tell. Once it finished flashing, I was expecting the camera to display a message or indicate what had been transferred but I didn't see anything, and then my camera just kind of locked up. Not sure if my camera's good enough to make this work. I'll try it again.

*ptsd triggers*
From what? QR codes? I mean, I kinda miss them too, but they were really bothersome to scan.
>PTSD >>I kinda miss them too I don't recall Post-Traumatic Stress Disorder being similar to nostalgia. What's even weirder is that this isn't completely useless, because the web-based modem alternatives are PC->3DS only.

I gave this a try, at least I think this is the same as the program you just published. It looked like it was doing something, but I couldn't tell. Once it finished flashing, I was expecting the camera to display a message or indicate what had been transferred but I didn't see anything, and then my camera just kind of locked up. Not sure if my camera's good enough to make this work. I'll try it again.
When you start the webcam end it says "Receiving..." and the black box turns white. The white box will change colors based on the colors it's receiving. When the program is finished, the 3DS screen will turn white, and the white box will turn white, and after a few seconds it will tell you your message. Try doing it on a really low setting and see if the box on the PC end changes colors with the 3DS screen. If it does, it's working, if it does not, it's not working.
What's even weirder is that this isn't completely useless, because the web-based modem alternatives are PC->3DS only.
To be honest, I made the program just because I could. It was more for the fun of it than any practical usage.

*ptsd triggers*
From what? QR codes? I mean, I kinda miss them too, but they were really bothersome to scan.
>PTSD >>I kinda miss them too I don't recall Post-Traumatic Stress Disorder being similar to nostalgia. What's even weirder is that this isn't completely useless, because the web-based modem alternatives are PC->3DS only.
...Why do you always sound like you hate the whole world...?

*ptsd triggers*
From what? QR codes? I mean, I kinda miss them too, but they were really bothersome to scan.
>PTSD >>I kinda miss them too I don't recall Post-Traumatic Stress Disorder being similar to nostalgia. What's even weirder is that this isn't completely useless, because the web-based modem alternatives are PC->3DS only.
...Why do you always sound like you hate the whole world...?
because people ask him questions like that

What about sending from pc to 3ds?

What about sending from pc to 3ds?
SmileBASIC does not have camera access. --- On another note, I have produced something completely superior where you can essentially send data at 3000 bytes every ~15 seconds, which is, you know, 1600 bps. Obviously far better than my solution. I did it simply by drawing the color code all on the screen at once and then you take a screenshot with the 3DS using Miiverse and the program on the other end can decode the screenshot. So far, you can store 3000 bytes in a single screenshot, and it takes ~15 seconds to connect to Miiverse, save the screenshot, then return to the game. I will upload this thing soon.