IR decoding

steliosm

Senior Member
Hello all. I am tying to decode an IR toy in order to 'expand' it's uses. The toy uses a wand (ir transmitter) and a 'magic egg' (ir receiver). I used a logic probe to peek on the signals transmitted from the wand and then tried to lookup the start bit, pause, logic 1/0 bit duration in order to figure out the protocol.

24029


That didn't work. A ~6ms start bit and then ~0.6ms pause bit combination doesn't seem to be a documented protocol. Changing the settings in the logic probe software I tried to see if I could decode it as serial transmission and see how close I could get at getting consinstent data. That was easier that I though in the first place, since setting the decoder at 4800, true output it seems it worked:

24030

The data output is pretty consistent actually, besides the framing error reported as 0. Maybe this is used as an interrupt to wake up the receiver. I got the same results while probing the receiver toy and with a breadboarded IR decoder at 38KHz. The 08M2 can read the data quite fine running at 16MHz, to avoid data overlaps as the data is send as a burst of three identical transmissions.

Has anyone seen anything like that in a Chinese toy? Using serial data instead of IR codes (Sony, NEC, etc)? Anyone can identify the IR protocol maybe?

Thank you.
~stelios
 

papaof2

Senior Member
That sounds like it might be SIR - Simple InfraRed - a protocol tihat goes back at least to the original Palm Pilot and some laptops of the era had IR ports for talking to the Palm devices and IR printers such as the Sipix A6 and others. The Palm devices could print to that printer and others by using third-party software. Perhaps someone in Chna revived an old protocol for a new toy? Maybe they found a box of IR chips that weren't used 20-odd years ago? (The Palm Pilot was introduced in 1996 or so and IR was added in the next year or so.)
 

steliosm

Senior Member
Well, I learnt a new thing today! I will look up SIR to see if it matches what I have found already. The transmitter and the receiver don't use any IR decoding chips, e.g. PT2221/PT2222, it's just the micro controller, so it's all happening in the firmware. My guess is also that they tried to figure out a simple way to transmit data without the hassle of using an already established IR protocol. Given the fact that this toy (Wizard's Battle) hides a lot of surprises in it, it does make sense that they kept the firmware simple.
 

jscottb

Active member
In my Chinese "black box" exploration in the near past, I have seen them just send data in a simple serial stream with no real protocol used. i.e. They made it up as they went along :) Can you see what uC they use to drive the signal? I may be a magic blob or an unmarked chip.
 

steliosm

Senior Member
Unfortunately, it is an unmarked 16pin chip. I tried sourcing the manufacturer/factory in alibaba or made-in-chine but no luck. Also, since this toy doesn't emit RF I couldn't find anything in the FCC site as well.
It does make sense to use a simple serial protocol and cut down on development times.
 

jscottb

Active member
Sometimes the markings are on the bottom of the chip. I would guess an STC chip, like the stc15w402as or 401. The markings could have bee removed by the maker or they could also be knock-offs. This is a very common uC in toys from Shenzen. They are 8051 cored, easy to program, and are cheap. Vcc is usually the third pin from the bottom on the left side and GND in the bottom pin on that side.
 

steliosm

Senior Member
I don't think it's an STC chip. I just checked the pinout, I get GND on pin 1 and Vcc on pin 16.
Have you used an STC chip? Any change this comes with a bootloader? They are pretty chip though!
 

jscottb

Active member
I actually like them a lot. They are easy to program having a built-in ISP. It only takes Rx/Tx Vcc and GND to program via a serial cable/adaptor. I use sdcc for the compiler and the stcgal (python script) to do the hex file load. PlatformIO actually has support for it and will get you going fast with the tools needed.

I have been getting my chips from LCSC after several times of getting the wrong chips off Ebay and AllyE. They are reasonably priced from there and I get what I ordered :)

Scott
 

steliosm

Senior Member
I like the price and the built-in ISP feature. I think I might order a few to have a go, just for fun. I still have some arduinos around to have a go with, which I haven't even touched yet. Every time I have an idea for a fun project I just pull out a picaxe from the drawer and start building on it!
Thank you for the information on the chip!
 

steliosm

Senior Member
Yes, that one! Madeby Fotorama. You can get this toy in my country (Greece) for less that 10 euros.
I have decoded the IR data and I am currently using it to turn remote Rd plugs on and off. I am planning to write a description on the project at some point.
 
Top