Continued-Infrared module for JR compatible TX, including 9x

Where to find parts? Refactoring your entire transmitter, new cases? Sticks etc..
dfink941
Posts: 2
Joined: Sun Dec 29, 2013 5:58 pm
Country: -

Re: Continued-Infrared module for JR compatible TX, includin

Post by dfink941 » Mon Jan 06, 2014 1:37 am

I have a S107C. It's the syma107 with a camera. The Board is labled S107R5. There are two extra buttons, one to take a picture and one to start video. When you press the video button it momentarily takes the first bit of the yaw byte high(on the 107G this is always low) and when you take a picture it does the same for the pitch byte. Otherwise everything is the same as the 107G however the code posted on here does not work with the 107C. The pulses are from time to time eratic and not uniform. I think that the S107C may run a different firmware with better filtering and it is throwing out too many of the pulse trains. I am using an Atmega328 demilanove processor. Is there an archive for the older versions of IRmodule? If not it would be wonderful to create one.

User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Continued-Infrared module for JR compatible TX, includin

Post by rperkins » Mon Jan 06, 2014 1:21 pm

Thats cool info. Thanks
I havent worked with this for awhile.
You may be right about the older versions as they used a library to generate the pulses.
here are the previous versions I still have.
.09 is the current

http://www.randyperkins.com/images/IrModule_v.04.zip
http://www.randyperkins.com/images/IrModule_v.05.zip
http://www.randyperkins.com/images/IrModule_v.06.zip
http://www.randyperkins.com/images/IrModule_v.07.zip
http://www.randyperkins.com/images/IrModule_v.08.zip
Last edited by rperkins on Sun Jan 08, 2017 10:48 am, edited 1 time in total.

dfink941
Posts: 2
Joined: Sun Dec 29, 2013 5:58 pm
Country: -

Re: Continued-Infrared module for JR compatible TX, includin

Post by dfink941 » Sat Jan 11, 2014 12:52 am

Thank you for posting the different versions of your code. As it turns out, my problems were in my hardware setup and not the software. I Modified irModule Version .09 to include the ability to control the camera on the S107C heli. I also changed things around to make it Mode 2 on my turnigy 9x(throttle-yaw on the left stick and aileron-pitch on the right). To start and stop recording video you momentarily push the aileron stick full right. To take a picture, you push full left. I could have used the switches on my tx but I figured I'd keep all controls on the sticks so that it will work with other simple 4 channel radios and also I wanted to be able to manage all control without taking my thumbs off the sticks. Everything else is the same. It works perfect on the S107C and I would bet that it will still work on the S107G however I can not test on a S107G as I don't have one.
Attachments
CamIRModule.txt
(7.94 KiB) Downloaded 117 times
CamIRModule.rar
(2.95 KiB) Downloaded 60 times

User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Continued-Infrared module for JR compatible TX, includin

Post by rperkins » Sat Jan 11, 2014 2:38 am

Hi
Glad you got it going and thanks for posting your code. That way if I anyone else takes this further it is there to use and integrate it into the module.

I bet your right and it should work as the s107 I had the board was marked S107R5. When I was working this there were other boards revisions out there and I have no idea what is being sold at this time.

andrewju
Posts: 718
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by andrewju » Sun Jan 08, 2017 8:33 am

Does anyone use this thing nowadays?

I'm trying to salvage my son's Syma S107G. Its stock remote control didn't power up at all, so I thought it's a good chance to build this add-on for my 9x. I made a small circuit and reused the LEDs from the stock radio. The original download links don't seem to work anymore, so I used the .zip provided by dfink941 in the post above.

The issue is that it doesn't seem to work. I added one regular LED to the stock 3 IRs for testing, so it helps to visualize what is going on. The LED only blinks for a fraction of a second, then there is a long pause (for about a minute), then it blinks for another fraction of a second again, and so on. This doesn't seem to depend on the input (PPM) signal at all.

I think I may have missed something when I flashed the sketch, or maybe my Arduino version is wrong (I use 1.0.6). If someone still has the original code by Randy, can you please share it?

Thanks!


User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by rperkins » Sun Jan 08, 2017 10:34 am

Greeting from Spring Hill Tennessee

Here they all are. I havent messed with this since my last post. I've moved several times this last year and pretty sure I threw out all my S107. Still got my MCPX though :) I'm now living in Tennessee and there is an RC park a few miles away. Just need to work less and play more. I hope everyone here is doing well.

http://1and1.perkosolutions.com/irmodule/

User avatar
jhsa
Posts: 17816
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by jhsa » Sun Jan 08, 2017 11:01 am

Hey rperkins, nice to see you here again. It's been a while ;) :)

@andrewju

You can "see" an infrared LED's light if you point your mobile's camera to it :) :)

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

andrewju
Posts: 718
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by andrewju » Sun Jan 08, 2017 11:03 am

I certainly wouldn't be able to resist if there is an RC community not far from where I live! Well, in fact I don't even try to resist! :)

Thanks a lot for the link! I checked v.09 and it behaves exactly the same. Even if there's nothing on PIN8 of the Arduino (PPM line disconnected), the LED still flashes briefly, then waits (the pause is 30 seconds - this time I measured it), then flashes briefly again, and so on. Does this, by any chance, sound familiar? I'm re-reading this topic, but I don't think a similar issue was discussed...

I wonder what I could have done wrong. I use an Arduino Pro Mini m328 16MHz version. The PPM line goes to pin 8 and LED output is taken from pin 11. That's basically it. I'm driving LEDs using a FET, but that shouldn't be related (as the LEDs blink from time to time, meaning that the circuit works).

andrewju
Posts: 718
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by andrewju » Sun Jan 08, 2017 11:06 am

jhsa wrote: You can "see" an infrared LED's light if you point your mobile's camera to it :) :)
The regular LED connected in series with the 3 IR LEDs saves me from having to use my mobile phone! :)

User avatar
jhsa
Posts: 17816
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by jhsa » Sun Jan 08, 2017 11:31 am

Ahh, you connected it in series.. Ok then. :)
I used my mobile phone's camera many times to diagnose problems with all sorts of IR remote controls. Not RC though ;) :mrgreen:

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

andrewju
Posts: 718
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by andrewju » Sun Jan 08, 2017 12:16 pm

I used my phone's camera at first. But then I though a regular LED would be much more convenient! :)

Meanwhile, I used an Arduino 1.0.2 and even tried a different Pro Mini to load the sketch to. It's still the same.

I must have done something wrong. Hmmm...

User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by rperkins » Sun Jan 08, 2017 12:21 pm

its been a long time but glancing at the code it looks like you are using the correct in and out pins.

remember if you try version 8 or earlier the output pin is different and you will need to download the library mentioned in the readme.

the only advice I can give is to hookup the LED_OUTPUT_PIN . reading through the code it looks like it flashes when the output is active and is solid when there is no output. I am wondering if your throttle is turned up. there is some code that turns the output off if the throttle is not up
// check to see if throttle is above zero
if (ppmInput[0] > 2000)

Sorry cant be of more help.

@JHSA - thanks . I check in and read a few posts every now and then but RC seems to be something I played with for a bit but not much lately. Hopefully I can at least get my workbench back together this year. take care

User avatar
jhsa
Posts: 17816
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by jhsa » Sun Jan 08, 2017 1:09 pm

;) :)
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

andrewju
Posts: 718
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by andrewju » Sun Jan 08, 2017 5:00 pm

For this module, the throttle is supposed to be in CH1, right? That's what I have set up in my mixes. So it should definitely start from 0. I will experiment with extended limits, just in case... I'll also check whether PPM polarity is the reason for my problems.
Oh! And I'll add another LED to the LED_OUTPUT_PIN (A0). Just need some time for this.

Right now I tend to think something is wrong with the PPM Input. Because output doesn't seem to depend on the PPM signal at all.

I will post back when I have some progress (just in case someone runs into a similar issue)...

Thanks a lot!!!

andrewju
Posts: 718
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by andrewju » Sun Jan 08, 2017 7:15 pm

UPDATE:
The issue seem to be in the radio I use.

On Turnigy 9x with er9x r819 the IR module works "as is". At least, the LED flashes properly (didn't test with a heli, yet).
On an AR9x board with ersky9x r220 the IR module doesn't seem to work at all.

On both radios the protocol settings are the same (PPM, 8CH, polarity = POS). It seem to work with both positive and negative polarity on er9x, but doesn't work in neither of these settings in ersky9x.

User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by rperkins » Sun Jan 08, 2017 7:33 pm

Glad you are narrowing it down. ER9x is the firmware that I used with a 9X and the IR module.
originally I only outputted 4 channels, as that is all I need. Maybe you could experiment with only outputting 4 channels and setting radio up as such.
the code for the module would need to be edited .

User avatar
jhsa
Posts: 17816
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by jhsa » Sun Jan 08, 2017 8:02 pm

Is the arduino working with 5V?
The stock 9x board outputs the PPM signal at around 5V. The Ar9x board does it at about 3.3V
Maybe that makes a difference?

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

User avatar
Kilrah
Posts: 9518
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by Kilrah » Sun Jan 08, 2017 9:01 pm

Do you have a setting for "OpenDrain" or "fulldrive" on the AR9X? If yes you probably want the latter.

andrewju
Posts: 718
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by andrewju » Sun Jan 08, 2017 9:28 pm

Hmm... I thought so too... But I decided to make some more tests first...

When I power the radio ON with the IR module connected, the module gets into a "strange" state where it doesn't react to the PPM stream at all. If I plug the module in when the radio is already ON, the IR module works and can even control my helicopter. Wooohooo! :) It's like that only on my ersky9x / AR9x radio. With Turnigy 9x (stock mainboard) it works fine from the very first moment. Well, at least now I know how to work with it, so I can manage it on AR9x, too.

There is an issue though. When throttle is at 0 and the radio is left switched on, the IR module still sends something out every 30 seconds. When this happens, the helicopter starts its motor briefly. This is not a big deal if one remembers about it. But it can be quite dangerous when playing together with kids. BTW, this happens on both er9x and ersky9x. It even happens when the PPM line is completely disconnected. So it must be something in the Arduino code.

I'm quite far from coding myself, but I'll find some time to look into the Arduino sketch. Will try to see if I can break it further! :)
I will certainly share if I get any success!

Randy, thanks a lot for the great project!!!

andrewju
Posts: 718
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by andrewju » Sun Jan 08, 2017 9:29 pm

Kilrah wrote:Do you have a setting for "OpenDrain" or "fulldrive" on the AR9X? If yes you probably want the latter.
I don't think we have it. At least, I never saw such...

User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by rperkins » Sun Jan 08, 2017 10:01 pm

andrewju wrote: There is an issue though. When throttle is at 0 and the radio is left switched on, the IR module still sends something out every 30 seconds. When this happens, the helicopter starts its motor briefly.
I had that problem at one time and adjusted the code to try to compensate. I'd be curious if the status led was flashing all the time even if you had the throttle at zero.

This last version was a big change. I rolled all the code taken from the borrowed library and rolled it into the main sketch. I was working towards running the module on an usbasp hardware and also wanted to be ready to add additional modules. well none of that was finished :-(

What I am getting at is now that you have narrowed down your hardware issues, you may want to try version 8 and see if that works better. remember the output is on a different pin if try an earlier revision.

It's been neat looking at my old project ( which reuses a lot of code from others as mentioned within). Most winters I have a project. This winter it is making a laundry room in the basement. ha ha

User avatar
MikeB
9x Developer
Posts: 15622
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by MikeB » Sun Jan 08, 2017 10:11 pm

OpenDrain/FullDrive is only on the 9XR-PRO.

Mike.
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
Kilrah
Posts: 9518
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by Kilrah » Sun Jan 08, 2017 10:25 pm

rperkins wrote: This winter it is making a laundry room in the basement. ha ha
That sounds both a lot less fun but a lot more "useful" :D

User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by rperkins » Sun Jan 08, 2017 10:32 pm

Kilrah wrote:
rperkins wrote: This winter it is making a laundry room in the basement. ha ha
That sounds both a lot less fun but a lot more "useful" :D
yea but it does get me out of my chair and off of my fat @ss :-)

andrewju
Posts: 718
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by andrewju » Sun Jan 08, 2017 10:37 pm

rperkins wrote:I had that problem at one time and adjusted the code to try to compensate. I'd be curious if the status led was flashing all the time even if you had the throttle at zero.
I understand the status led works "reversed" due to how it is implemented on the USBasp. In my case, I just plugged a LED to the Arduino port. So my status LED is off when it is supposed to be on, and vice versa. So when the Throttle is 0 my status LED is OFF. Then after 30 seconds of "silence" the status LED flashes briefly - that's when the module is transmitting. And then it waits for another 30 seconds.
rperkins wrote:This last version was a big change. I rolled all the code taken from the borrowed library and rolled it into the main sketch. I was working towards running the module on an usbasp hardware and also wanted to be ready to add additional modules. well none of that was finished :-(
Yes, I learned that from the changelog and also from the previous conversations in this thread. :)

rperkins wrote:What I am getting at is now that you have narrowed down your hardware issues, you may want to try version 8 and see if that works better. remember the output is on a different pin if try an earlier revision.
I couldn't compile it even with IRrc library files placed in the IRrc folder. Arduino gives me an error "IrModule:22: error: 's107_r5' does not name a type". I made a quick search and it may mean the files are in a wrong place. But I think they're at the right folder (under library/IRrc/ ).

I think I'd better wrap my head around the v09 - at least it's all in one file there. :)
Need to spend some time and understand how the code works. There are lots of comments in there (thanks!!!), so I have a feeling I can make it!
rperkins wrote:It's been neat looking at my old project ( which reuses a lot of code from others as mentioned within). Most winters I have a project. This winter it is making a laundry room in the basement. ha ha
Did you ever consider to add an RC stack there? So that you could control it with your Turnigy? :)
Seriously speaking, I'm thinking more and more towards smart home technologies recently. These are still quite expensive, and I don't fully understand why. In my opinion, there should be "building blocks" available, similar to Arduino - cheap and easy to work with. I'll give it some more thought after I finish with the IR module! :)

User avatar
Kilrah
Posts: 9518
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by Kilrah » Sun Jan 08, 2017 10:50 pm

andrewju wrote: Seriously speaking, I'm thinking more and more towards smart home technologies recently. These are still quite expensive, and I don't fully understand why.
Because it's the last thing people are able to market with reasonable margins due to marketing still managing to maintain the general public's feeling that it's trendy, new, complex and "the next best thing you really need to have" so they milk the cow as much as they can, while they can.

But if you can/want to DIY you can take a $4 ESP8266 module and make a full WiFi-controlled "IoT"/"smart" project with it, potentially not even needing a separate controller depending on what your needs are.

User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by rperkins » Sun Jan 08, 2017 11:16 pm

I think the 30 second duration is when the arduino timer overflows and resets. Cant remember which timer as the sketch uses 2 of them. at least my foggy memory remembers something along that line. It does sound like your throttle is off as your led is not blinking during the 30 seconds..

yea home automation is coming. IOT and lack of firmware updates are going to be an issue. Right now I just wanna get the washer and dryer out of the middle of the garage :-)


Here is the directory layout of my arduiono sketch directory.

Code: Select all

[email protected]:/pub/my_data/sketchbook$ tree
.
├── acs712_current_sensor
│   └── acs712_current_sensor.ino
├── ard_ir_display
│   └── ard_ir_display.ino
├── Atmega_Board_Programmer
│   ├── Atmega_Board_Programmer.ino
│   ├── bootloader_atmega1280.h
│   ├── bootloader_atmega1284.h
│   ├── bootloader_atmega168.h
│   ├── bootloader_atmega2560_v2.h
│   ├── bootloader_atmega328.h
│   ├── bootloader_atmega8.h
│   ├── bootloader_lilypad328.h
│   ├── gpl.txt
│   ├── md5.c
│   └── md5.h
├── diydrones_read_ppmsum
│   └── diydrones_read_ppmsum.ino
├── ds1077
│   └── ds1077.ino
├── IR_analyzer
│   └── IR_analyzer.ino
├── IrModule
│   ├── IrModule.ino
│   └── IrModule.ino.bak
├── IrModule3
│   └── IrModule3.ino
├── IrModule_old
│   └── IrModule_old.ino
├── libraries
│   ├── cppfix
│   │   └── cppfix.h
│   ├── IRrc
│   │   ├── doc
│   │   │   ├── annotated.html
│   │   │   ├── bc_s.png
│   │   │   ├── bdwn.png
│   │   │   ├── classes.html
│   │   │   ├── classIRheli__coll__graph.map
│   │   │   ├── classIRheli__coll__graph.md5
│   │   │   ├── classIRheli__coll__graph.png
│   │   │   ├── classIRheli.html
│   │   │   ├── classIRheli__inherit__graph.map
│   │   │   ├── classIRheli__inherit__graph.md5
│   │   │   ├── classIRheli__inherit__graph.png
│   │   │   ├── classIRheli-members.html
│   │   │   ├── classIRrc.html
│   │   │   ├── classIRrc__inherit__graph.map
│   │   │   ├── classIRrc__inherit__graph.md5
│   │   │   ├── classIRrc__inherit__graph.png
│   │   │   ├── classIRrc-members.html
│   │   │   ├── closed.png
│   │   │   ├── doxygen.css
│   │   │   ├── doxygen.png
│   │   │   ├── dynsections.js
│   │   │   ├── files.html
│   │   │   ├── ftv2blank.png
│   │   │   ├── ftv2cl.png
│   │   │   ├── ftv2doc.png
│   │   │   ├── ftv2folderclosed.png
│   │   │   ├── ftv2folderopen.png
│   │   │   ├── ftv2lastnode.png
│   │   │   ├── ftv2link.png
│   │   │   ├── ftv2mlastnode.png
│   │   │   ├── ftv2mnode.png
│   │   │   ├── ftv2mo.png
│   │   │   ├── ftv2node.png
│   │   │   ├── ftv2ns.png
│   │   │   ├── ftv2plastnode.png
│   │   │   ├── ftv2pnode.png
│   │   │   ├── ftv2splitbar.png
│   │   │   ├── ftv2vertline.png
│   │   │   ├── functions_func.html
│   │   │   ├── functions.html
│   │   │   ├── functions_vars.html
│   │   │   ├── graph_legend.html
│   │   │   ├── graph_legend.md5
│   │   │   ├── graph_legend.png
│   │   │   ├── hierarchy.html
│   │   │   ├── index.html
│   │   │   ├── inherit__graph__0.map
│   │   │   ├── inherit_graph_0.map
│   │   │   ├── inherit__graph__0.md5
│   │   │   ├── inherit_graph_0.md5
│   │   │   ├── inherit__graph__0.png
│   │   │   ├── inherit_graph_0.png
│   │   │   ├── inherits.html
│   │   │   ├── IRheli_8h_source.html
│   │   │   ├── IRheli_8h-source.html
│   │   │   ├── IRrc_8h_source.html
│   │   │   ├── IRrc_8h-source.html
│   │   │   ├── jquery.js
│   │   │   ├── LED-Output.pdf
│   │   │   ├── LED-Output.s#1
│   │   │   ├── LED-Output.s#2
│   │   │   ├── LED-Output.sch
│   │   │   ├── nav_f.png
│   │   │   ├── nav_g.png
│   │   │   ├── nav_h.png
│   │   │   ├── open.png
│   │   │   ├── tab_a.png
│   │   │   ├── tab_b.gif
│   │   │   ├── tab_b.png
│   │   │   ├── tab_h.png
│   │   │   ├── tab_l.gif
│   │   │   ├── tab_r.gif
│   │   │   ├── tabs.css
│   │   │   └── tab_s.png
│   │   ├── examples
│   │   │   ├── HeliDemo
│   │   │   │   └── HeliDemo.pde
│   │   │   ├── HeliRCRx
│   │   │   │   └── HeliRCRx.pde
│   │   │   └── USBJoystickHeli
│   │   │       └── USBJoystickHeli.pde
│   │   ├── IRheli.cpp
│   │   ├── IRheli.h
│   │   ├── IRrc.cpp
│   │   ├── IRrc.cpp.new
│   │   ├── IRrc.cpp.orig
│   │   ├── IRrc.h
│   │   ├── LICENSE
│   │   ├── Makefile
│   │   ├── MANIFEST
│   │   ├── perl
│   │   │   └── js.pl
│   │   ├── project.cfg
│   │   ├── s026g.cpp
│   │   ├── s026g.h
│   │   ├── s107_r5.cpp
│   │   └── s107_r5.h
│   ├── MemoryFree
│   │   ├── MemoryFree.cpp
│   │   └── MemoryFree.h
│   ├── NewTone
│   │   ├── keywords.txt
│   │   ├── NewTone.cpp
│   │   └── NewTone.h
│   ├── PinChangeInt
│   │   ├── Examples
│   │   │   ├── ByteBuffer
│   │   │   │   ├── ByteBuffer.cpp
│   │   │   │   └── ByteBuffer.h
│   │   │   ├── PinChangeIntExample
│   │   │   │   └── PinChangeIntExample.pde
│   │   │   ├── PinChangeIntSpeedTest
│   │   │   │   └── PinChangeIntSpeedTest.pde
│   │   │   └── PinChangeIntTest
│   │   │       └── PinChangeIntTest.pde
│   │   ├── keywords.txt
│   │   └── PinChangeInt.h
│   └── readme.txt
├── modes
├── My_Blink
│   └── My_Blink.ino
├── My_Blink_betemcu_m8
│   └── My_Blink_betemcu_m8.ino
├── My_Blink_betemcu_m8_slow
│   └── My_Blink_betemcu_m8_slow.ino
├── My_Blink_programmer_slow
│   └── My_Blink_programmer_slow.ino
├── onewire
│   └── onewire.ino
├── packaged_IrModule
│   ├── IrModule_v.09.zip
│   ├── LICENSE
│   ├── README.TXT
│   ├── sketchbook
│   │   └── IrModule -> ../../IrModule/
│   ├── update_package
│   └── version.txt
├── proc_ir_display
│   └── proc_ir_display.pde
├── pull
├── push
├── srf04_ultrasonic_distance
│   └── srf04_ultrasonic_distance.ino
├── throttle_test
│   └── throttle_test.ino
├── timer_ctc
│   └── timer_ctc.ino
├── timers
│   └── timers.ino
├── tools
└── usbasp_cloner
    ├── convert.py
    ├── firmware
    │   ├── convert.py
    │   ├── firmware.h
    │   ├── firmware_list.txt
    │   ├── generator_script
    │   ├── usbasp.2009-02-28.diff
    │   ├── usbasp.2009-02-28.patched.hex
    │   ├── usbasp.2009.patched.100ma.hex
    │   ├── usbasp.2011-05-28.diff
    │   ├── usbasp.2011-05-28.patched.hex
    │   ├── usbasp.atmega8.2009-02-28.hex
    │   └── usbasp.atmega8.2011-05-28.hex
    ├── firmware.h
    ├── firmware_list.txt
    ├── functions.h
    ├── gpl.txt
    ├── readme.txt
    ├── tscript
    └── usbasp_cloner.ino

andrewju
Posts: 718
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by andrewju » Mon Jan 09, 2017 3:14 pm

I was looking at the code of v09 in order to fix these "unwanted" IR pulses sent every 30 seconds when Throttle is at 0.

I found a throttleWatchdog counter:

Code: Select all

  static byte throttleWatchdog;
It is supposed to keep the IR output blocked when there's no Throttle. It is set to 0 whenever the throttle is above 0. Else, it is increased by 1 with each new loop cycle. As I understand, a counter of a byte long can only store values of up to 256. This is probably the reason. If Throttle stays at 0 long enough, the counter will overflow (I'm not sure if it'll start from 0 again, or stay at 255) - that's when the 'glitch' happens...

I just changed the 'byte' to 'long' in order to make the possible counter value bigger ('long' is 4 bytes, if I'm not mistaken).

Code: Select all

  static long throttleWatchdog;
This seem to fix it for me! I can still control the helicopter (surprisingly, I didn't break the core functionality!), and there are no "unwanted" pulses when Throttle is at 0 (I think I waited for at least a couple of minutes).

This is probably not a 100% solution (in theory, even a 4-bytes counter will overflow if Throttle is kept at 0 for too long), but it should make it pretty safe at least for my usecase.


I'm still not sure how this relates to 30 seconds intervals that I observed. I mean, with the PPM frame length of 22.5mS, a 1-byte counter should have reached its limit in less than 6 seconds. Maybe the code processes every 5th PPM pulse only - that would have explained it, although I didn't see it in the code (yet).


Anyway, I'll give it some more testing over the next few days.

User avatar
jhsa
Posts: 17816
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by jhsa » Mon Jan 09, 2017 3:39 pm

Hmmm... I have started blinking LEDs and he starts with the most difficult "Long" stuff :twisted: :roll: Hummppffff :o :evil: :( Only Showing Off.. :?

:mrgreen: :mrgreen: :mrgreen:

Well done ;) :)

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

andrewju
Posts: 718
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: Continued-Infrared module for JR compatible TX, including 9x

Post by andrewju » Mon Jan 09, 2017 5:59 pm

Huh! "Blinking LEDs", you say? :)
Long stuff first! :mrgreen:

Post Reply

Return to “Hardware Mods”