patricknevindwyer / arduino-magiquest

Arduino + IR sensor for MagiQuest
GNU Lesser General Public License v2.1
33 stars 2 forks source link

wand_id and magnitude are both zero (0) #1

Open Tiogaplanet opened 4 years ago

Tiogaplanet commented 4 years ago

Thank you for these repo! Very helpful in determining that I can use my two wands with an Arduino. The wands are being detected but my output shows wand_id and magnitude always equal zero for both wands. Will try to troubleshoot./debug.

Tiogaplanet commented 4 years ago

Went back to kitlaan's previously confirmed working version and found that things have probably changed in the last three years. My output shows that Magiquest wands are spitting out 32 bits, not 56.

Attempting NEC decode
Testing mark 250 vs 9000: 136 <= 5 <= 228
Attempting Sony decode
Attempting Sanyo decode
Attempting Mitsubishi decode
Attempting RC5 decode
Testing: 14 <= 5 <= 25
Testing: 28 <= 5 <= 47
Testing: 41 <= 5 <= 70
Attempting RC6 decode
Testing mark 250 vs 2666: 41 <= 5 <= 70
Attempting Panasonic decode
Testing mark 250 vs 3502: 54 <= 5 <= 91
Attempting LG decode
Attempting JVC decode
Testing mark 250 vs 8000: 121 <= 5 <= 203
Attempting SAMSUNG decode
Testing mark 250 vs 5000: 76 <= 5 <= 128
Attempting Whynter decode
Attempting Aiwa RC-T501 decode
Attempting Denon decode
Attempting Magiquest decode
Encoding  : UNKNOWN
Code      : 9610BAA4 (32 bits)
Timing[21]: 
     + 250, - 850     + 250, - 800     + 300, - 800     + 250, - 850
     + 250, - 900     + 200, - 850     + 200, - 900     + 150, - 950
     + 200, - 900     + 500, -1750     + 450
unsigned int  rawData[21] = {250,850, 250,800, 300,800, 250,850, 250,900, 200,850, 200,900, 150,950, 200,900, 500,1750, 450};  // UNKNOWN 9610BAA4

Attempting NEC decode
Testing mark 200 vs 9000: 136 <= 4 <= 228
Attempting Sony decode
Testing mark 200 vs 2400: 37 <= 4 <= 63
Attempting Sanyo decode
Testing mark 200 vs 3500: 54 <= 4 <= 91
Attempting Mitsubishi decode
Attempting RC5 decode
Testing: 14 <= 4 <= 25
Testing: 28 <= 4 <= 47
Testing: 41 <= 4 <= 70
Attempting RC6 decode
Testing mark 200 vs 2666: 41 <= 4 <= 70
Attempting Panasonic decode
Testing mark 200 vs 3502: 54 <= 4 <= 91
Attempting LG decode
Attempting JVC decode
Testing mark 200 vs 8000: 121 <= 4 <= 203
Attempting SAMSUNG decode
Testing mark 200 vs 5000: 76 <= 4 <= 128
Attempting Whynter decode
Attempting Aiwa RC-T501 decode
Attempting Denon decode
Testing mark 200 vs 300: 6 <= 4 <= 11
Attempting Magiquest decode
Encoding  : UNKNOWN
Code      : C9236562 (32 bits)
Timing[31]: 
     + 200, - 900     + 250, - 850     + 200, - 900     + 200, - 900
     + 200, - 900     + 250, - 850     + 200, - 900     + 250, - 850
     + 200, - 900     + 500, - 650     + 250, - 850     + 500, - 650
     + 500, - 650     + 500, - 650     + 500, - 700     + 450
unsigned int  rawData[31] = {200,900, 250,850, 200,900, 200,900, 200,900, 250,850, 200,900, 250,850, 200,900, 500,650, 250,850, 500,650, 500,650, 500,650, 500,700, 450};  // UNKNOWN C9236562

I edited ir_Magiquest.cpp to:

#define MAGIQUEST_BITS               32

#define MAGIQUEST_TOTAL_USEC       1100
#define MAGIQUEST_ZERO_RATIO         25  // usually <= ~25%
#define MAGIQUEST_ONE_RATIO          50  // usually >= ~50%

With no change. Appreciate any advice for further debug.

patricknevindwyer commented 4 years ago

I wonder if the wands have changed recently - how old are the wands you're testing with? The ones I originally worked with were 3-5 years old, if I remember correctly.

Tiogaplanet commented 4 years ago

I think they have changed. These wands are about two years old. Though the results above are for two wands, I have three and they all generate similar results. I don't have an o-scope but I'll keep trying to decode and debug as I find the time.

CoachT13 commented 4 years ago

I've just started playing around with this as well and am getting the same results (both value & magnitude returning 0s). We bought our wands last March, so they're almost a year old. Any progress made on decoding the MQ wand signals?

Tiogaplanet commented 4 years ago

Not yet. Been wondering though if anyone still has the old wands to make sure they still work with this code.

CoachT13 commented 4 years ago

I've been poking around - one discussion [https://github.com/crankyoldgit/IRremoteESP8266/issues/360] I found was pointing out the inconsistencies in results with using a 'standard' 38kHz IR receiver. I just ordered some 36kHz IR receivers - hoping that will give me consistent wand codes as that's one thing I've seen with some of the raw dumps from a IRrecvDumpV2.ino script.

Tiogaplanet commented 4 years ago

Well, that actually looks pretty promising. I'll pick up a few too and try it out to confirm.

On a related note, Magiquest support no longer exists in the master IR library branch anymore. Maybe improved documentation and another PR could get it back in.

Tiogaplanet commented 4 years ago

I got the 36KHz receiver and can confirm that it works correctly in mpflaga's library but not in this repository.

If I try to use this repo and the current IRremote library I still get zeros. I don't want to go back to past releases of IRremote in order to find the one that will work with this repo. If I use mpflaga's repo with this sketch, I get exit status 1 while compiling with error message, "redefinition of 'union magiquest'" which makes sense since this code was lifted directly from mpflaga's fork.

So, in short, the 36KHz receiver is the right one to use but this repo still needs a little debugging. That's all the time I have for now but I'll come back to this.

patricknevindwyer commented 4 years ago

On mobile now, but I’ll try and break out the different receivers later this week or this weekend and finally get some debugging done. All of this is fantastic information so far

CheddahN commented 2 years ago

Any updates on this? I’ve been wanting to clone wands for a while now and this repository seems to be the only lead I could find

recordandmix commented 1 year ago

Hi folks -- since it looks like Patrick may no longer be maintaining this code, I am pleased to report that I've done some troubleshooting with the developer of the "official" Arduino IRremote library. I don't know if there was a period of time where Magiquest was removed from "official" support, but later versions of the library do support it again.

As of version 4.0 -- newly released today after I worked with Arvin to troubleshoot the values I was seeing with my wands -- I now have five Magiquest wands that each consistently report the same address (aka wand_id). For reasons I don't understand, the wand_id values are not the same (in decimal OR hex) as the values Patrick's code reports, but that's really not an issue I care about or need to tackle. I'm simply looking for a way to confirm that a) a Magiquest code has been received, and b) it came from one of the five wands in my possession.

If you're looking to sell wands to passers-by to play in your knock-off RPG, that might not be enough for you! But if you've only got a wand or two that you'd like to use with your Arduino, you should be able to do so with v4.0 of the "standard" library without any surprises.

Good luck & happy modding! And Patrick -- if you're reading this -- thanks for your work on this issue as well! -Matt

sinkillerj commented 1 year ago

@recordandmix I don't have time to contribute to the code myself at the moment, but I would be happy to discuss what I know from my time working on the game, I spoke a bit on this at: https://old.reddit.com/r/flipperzero/comments/tcuwgb/ir_success_story_magic_wand/ihz3sfb/

Regarding wand differences, this is a very real possibility. Since the takeover GWL has made a few wand revisions coughoften to increase profit marginscough, with brand new retooled wands just being released recently. I've not had the chance to study these newer revisions.

Us nerds have a MQ Discord over at: https://discord.gg/8MCSzpUcBB