JP1 Remotes Forum Index JP1 Remotes


FAQFAQ SearchSearch 7 days of topics7 Days MemberlistMemberlist UsergroupsUsergroups RegisterRegister
ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in

Arduino sketch to generate raw code for use with IR Scope
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    JP1 Remotes Forum Index -> JP1 - Software
View previous topic :: View next topic  
Author Message
3FG
Expert


Joined: 19 May 2009
Posts: 3165

PostPosted: Thu Jan 09, 2014 12:39 am    Post subject: Reply with quote

I think 60KHz is high enough. Bang and Olafsen does of course run at 455KHz, and JP1 remotes can send these signals (PID 00EB, TV 0565, 0620, and Audio 0799). JP1 remotes can learn the signals in a sense, but detect the frequency as 0. It is possible to buy IR detectors which respond to at least a few MHz, but I don't really see much value in designing a circuit to support such detectors. I have seen no other consumer IR that runs above 60KHz.

As I understand it, detecting a single edge precludes capturing non-modulated IR signals, like Revox, Barco, Archer, PID 0000, and 0004. That's one of the deficiencies of the Widget approach. MiikeT's initial posts were interesting to me because it included detecting both edges,

Another issue with Widgets is the inability to accurately determine frequency for signal with short on bursts. As a practical matter, a true 56KHz signal may be decoded as 50KHz. I imagine the approach taken here will provide good frequency accuracy.

On a different tack, what do you guys think about the possibility to use a Leonardo or similar board with full speed USB capability (12Mbits/sec) to implement a Widget approach but using, say, 5uSec counting intervals? For single edges, that would be 1.6Mbits/sec into a computer. That way, the SRAM is only needed for buffering the USB communication.
Back to top
View user's profile Send private message
MikeT



Joined: 28 Oct 2010
Posts: 115

PostPosted: Mon Jan 27, 2014 4:43 pm    Post subject: Reply with quote

3FG wrote:
I think 60KHz is high enough.

This means I have 266 cycles for my code in the main loop Very Happy
I don't know where I'm now because I don't find my logic analyzer for the measurement.

3FG wrote:
Bang and Olafsen does of course run at 455KHz

The complex aggregation, value compression and frequency calculation cannot be done in 35 mcu cycles, that's too fast for this kind of capture.

3FG wrote:
As I understand it, detecting a single edge precludes capturing non-modulated IR signals, like Revox, Barco, Archer, PID 0000, and 0004. That's one of the deficiencies of the Widget approach. MiikeT's initial posts were interesting to me because it included detecting both edges,

How long are these signals, that means how many hi=>lo / lo => edges do these contain? Are 780 edges enough?

3FG wrote:
Another issue with Widgets is the inability to accurately determine frequency for signal with short on bursts. As a practical matter, a true 56KHz signal may be decoded as 50KHz. I imagine the approach taken here will provide good frequency accuracy.

I reduced the accuracy somewhat by enabling the prescaler, so each single measurement has an error of 1s. For 40 kHz this gives an accuracy of around 4% for a single pulse. When adding up multiple pulse-width, it should be better than 1%.
Currently I do the frequency measurement only for the first burst.

3FG wrote:
On a different tack, what do you guys think about the possibility to use a Leonardo or similar board with full speed USB capability (12Mbits/sec) to implement a Widget approach but using, say, 5uSec counting intervals? For single edges, that would be 1.6Mbits/sec into a computer. That way, the SRAM is only needed for buffering the USB communication.

This might be possible. The Saleae logic analyzer works in a similar way. Let's first finish a gadget which supports the two modes (raw and aggregated).

Michael
Back to top
View user's profile Send private message
3FG
Expert


Joined: 19 May 2009
Posts: 3165

PostPosted: Mon Jan 27, 2014 10:53 pm    Post subject: Reply with quote

The non-modulated IR protocols mostly have such short on durations that modulation is not needed or in some cases not even practical. Probably the most challenging for a Widget is Barco:
Code:
{0k,10}<1,-5|1,-15>(1,-25, D:5,F:6, 1,-25,1,120m)+
So this is 10uSec of on time, followed by either 50 or 150uSec of off. If one knows in advance that the signal is Barco, then the Widget output is sufficient to recover the bits. But an algorithm which purports to measure on and off durations wiht no a priori infomation can't handle this. Of course, we don't expect the Widget to handle signals with information content well past the Nyquist limit.

There are other non-modulated UR protocols with 500uSec on durations, but I don't recall the names or detailed characteristics. I doubt any equipment designed in the last decade or so would use this approach.
Back to top
View user's profile Send private message
MikeT



Joined: 28 Oct 2010
Posts: 115

PostPosted: Tue Jan 28, 2014 3:12 pm    Post subject: Reply with quote

3FG wrote:
Probably the most challenging for a Widget is Barco:
10uSec of on time

The original Arduino Sketch version without any pulse aggregation is able to capture any edges with at least 3s distance. Also the number of edges (up to around 780) should not be a problem for this protocol.

Is Barco PID 0x002A?

Michael
Back to top
View user's profile Send private message
3FG
Expert


Joined: 19 May 2009
Posts: 3165

PostPosted: Tue Jan 28, 2014 3:49 pm    Post subject: Reply with quote

Yes, Barco is PID 002A.
Back to top
View user's profile Send private message
MikeT



Joined: 28 Oct 2010
Posts: 115

PostPosted: Wed Jan 29, 2014 4:38 pm    Post subject: Reply with quote

I've made a new version which supports 3 modes without recompiling. You have to send one of the characters 'a', 'r' or 'b' to activate these modes and they are only active until a signal has been captured:
    press 'a' for aggregating capture
    press 'r' for raw capture (rising edges)
    press 'b' for raw capture (both edges)


The only one which can tell you the duty cycle is type 'b', but it takes twice as much time to process a edge and also the double amount of memory.

Raw capture never does aggregation (can be done in the PC if needed).

'r' mode doesn't print + or - before the numbers because only the time between rising edges is counted.

The polarity is now detected automatically and all #defines which enabled or switched functionality have been removed.

/edit: In the meanwhile I found my logic analyzer. 60kHz should not be a problem for 'a' and 'r'. When both edges are captured using 'b', it depends on the pulse-width if it can be handled.

Here the current output:
Code:
non-inverting sensor detected
bufferSize=1042
press 'a' for aggregating capture
press 'r' for raw capture (rising edges)
press 'b' for raw capture (both edges)
--- aggregating capture ------ f=40816 d=100 n=77
 +2365 -623 +573 -623 +1170 -623 +572 -623 +573 -623 +1170 -623 +573 -623 +573 -623 +1170 -622 +573 -623 +573 -623 +573 -623 +573 -25856 +2365 -623 +573 -623 +1170 -623 +573 -623 +573 -623 +1170 -623 +573 -623 +573 -623 +1170 -623 +573 -623 +572 -623 +573 -623 +573 -25856 +2365 -624 +573 -623 +1170 -623 +573 -623 +573 -623 +1170 -623 +573 -623 +573 -623 +1170 -623 +573 -623 +573 -623 +573 -623 +573
--- raw capture (rising edge) ------ f=40816 d=100 n=1041
 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 9472 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 622 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 622 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 9472 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 624 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 623 25 25 25 25 25 25 25 25 25
--- raw capture (both edges) ------ f=40816 d=28 n=1041
 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -616 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -615 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -615 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -615 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -615 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -615 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -615 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -615 +7 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -615 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -615 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -615 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -615 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -9456 +7 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -17 +8 -17 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8 -18 +8 -18 +8 -17 +8 -18 +8 -18 +8


Michael
Back to top
View user's profile Send private message
MikeT



Joined: 28 Oct 2010
Posts: 115

PostPosted: Sat Feb 01, 2014 9:09 am    Post subject: Reply with quote

I've improved the usability for switching between the modes. The command is now also accepted when a capture is already listening. After a capture has been finished, a new capture of the same type is started automatically.
The new source can be found here.

Michael
Back to top
View user's profile Send private message
MikeT



Joined: 28 Oct 2010
Posts: 115

PostPosted: Sun Feb 02, 2014 9:36 am    Post subject: Reply with quote

3FG wrote:
On a different tack, what do you guys think about the possibility to use a Leonardo or similar board with full speed USB capability (12Mbits/sec) to implement a Widget approach but using, say, 5uSec counting intervals?

I have added such modes ('n' and 'm') but it is very experimental. Actually I never looked at the data I got, but only for the time it takes to send the serial data.

The format must be binary (16 bit values, big-endian) and in MCU clocks (not in mikroseconds) because there is no time left for conversion of the values (costs at least 3s extra for the formatting and even more for clk=>time conversion).

To get the time in mikroseconds, the following code can be used:
Code:

const uint8_t CAPTURE_PRESCALER_BITS = 3;
const uint8_t RANGE_EXTENSION_BITS = 4; // factor for upper measurement range = 2^(RANGE_EXTENSION_BITS+1)
const uint8_t F_CPU = 16000000; // the clock of the Arduino
uint32_t index; // current index to buf
uint32_t clocks = unpackTimeValSwapped((buf[index] << 8) | (buf[index + 1]));
uint32_t timeInMikroSecs = ClocksToMikroSeconds(clocks);

uint32_t ClocksToMikroSeconds(uint32_t x)
{
  return ((x * (125UL << CAPTURE_PRESCALER_BITS)) / (F_CPU/8000000UL)); // will only work for F_CPU which are a multiple of 8MHz
}

inline uint32_t unpackTimeValSwapped(uint32_t val)
{
  if(val & 0x8000)
  {
    val = val & 0x7fff;
    uint32_t valOvl =  (val & (_BV(RANGE_EXTENSION_BITS) - 1)) << 16;
    uint32_t valTim =  (val << 1) & (0x7fff & ~(_BV(RANGE_EXTENSION_BITS) - 1));
    val = valOvl | valTim;
  }

  return val;
}


/edit: The minimum time needed for a single edge is 5.6s, so the highest possible frequency is below 89 kHz when capturing both edges.
/edit2: The code was using the wrong variant of unpackTime

The new source can be found here.

Michael
Back to top
View user's profile Send private message
MikeT



Joined: 28 Oct 2010
Posts: 115

PostPosted: Sun Feb 02, 2014 4:28 pm    Post subject: Reply with quote

MikeT wrote:

I have added modes 'n' and 'm' (no buffering, direct USB output).
The minimum time needed for a single edge is 5.6s, so the highest possible frequency is below 89 kHz when capturing both edges

It's now a bit faster, one edge takes only 3.2s to process.

To make detecting of the capture data a bit easier, the first value is always 0x0000 and the last value 0xffff.

The new source can be found here.

Michael
Back to top
View user's profile Send private message
MikeT



Joined: 28 Oct 2010
Posts: 115

PostPosted: Sat Feb 08, 2014 2:17 pm    Post subject: Reply with quote

MikeT wrote:
I have added modes 'n' and 'm' (no buffering, direct USB output which means unlimited capture length, requires Arduino Leonardo or other board with ATmega32U4).
It's now a bit faster, one edge takes only 3.2s to process.

The new version has been further improved, it needs 2.5s.

MikeT wrote:
To make detecting of the capture data a bit easier, the first value is always 0x0000 and the last value 0xffff.

I've added a second end tag 0xfffe for marking a failed capture when the USB send buffer had an overflow.

A command line tool has been added to the distribution as reference implementation (in C++) . It has exactly one parameter: the device name of the serial port
Here an example how to call it on my Mac with an Arduino Leonardo
Code:
IR_Widget/console_client/ArduinoIRWidget/ArduinoIRWidget\ 08.02.14\ 19.46\ MacOSX/ArduinoIRWidget  /dev/cu.usbmodemfd121
times[2799]=+10 -17 +9 -17 +10 -17 +10 -17 +10 -17 +9 -17 +10 -17 +10 -17 +9 -17 +9 -17 +10 -17 +10 -17 +9 -17 +9 -17 +10 -17 +10 -17 +9 -17 +10 -17 +10 -17 +10 -17 +9 -17 +10 -17 +10 -17 +10 -17 +9
...


The Mac XCode project of the tool can be found in the directory "console_client". It should easily be portable to Linux, but windows might require some more work.
The main purpose of the code was to have a working test and reference implementation as base for the Java implementation in IRScrutinizer.

The new source can be found here.

Michael
Back to top
View user's profile Send private message
Barf



Joined: 24 Oct 2008
Posts: 682

PostPosted: Sun Feb 09, 2014 4:06 am    Post subject: Reply with quote

Hallo Michael,

congrats to your progress, looks quite impressive. Sorry for not responding earlier; I was busy with getting IrScrutinizer 1.0.0 out.

IrScrutinizer 1.0.0's "Arduino capture interface" expects the Arduino to spit out strings like

Code:
f=38095 +14875 -11562 +14750 -11562 +14750 -11562 +14750 -11562 +14750 -11562 +14750 -11562 +14750 -11562 +14750 -11562 +14750 -11562 +14750 ... -200000


the "f=xxxxx" part being optional, The f argument is the only difference from 0.1.1, btw. This is the "aggregate form". Also note that the number of durations is even, the last one being the final silence, which happens to be identical to the preset ending timeout. So, for the short time solution, if you can have your sketch outputting this format, IrScrutinizer 1.0.0 unmodified will take it directly. (Ohh, 9600 baud hard soldered in... Embarassed )

The interface is done in the class org.harctoolbox.harchardware.ir.Arduino, sources download.

For other forms than the "aggregated", it is definitely interesting to be able to analyze signals in that detail, however, I think it is probably better to us programs like Matlab/Labview/Octave/Gnuplot or a spreadsheet program for doing the analysis. What do you think? Nevertheless, it would be nice to identify e.g. Barco as
Code:
f=0 +10 -250 +10 -50 +10 -50 +10 -150 +10 -150 +10 -50 +10 -50 +10 -150 +10 -50 +10 -50 +10 -50 +10 -150 +10 -250 +10 -120000


For the long time perspective: I wrote down my ideas of a modular, general IR server for sending, receiving, capturing. (The response format is not really defined there, though). What do you say?

Have you had a look at the Intel Galileo?

Finally, would you consider changing your license (GPL2) to e.g. "GPL2 or later"? Since IrScrutinizer is "GPL3 or later", it would make things simpler.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
MikeT



Joined: 28 Oct 2010
Posts: 115

PostPosted: Sun Feb 09, 2014 4:43 am    Post subject: Reply with quote

Hi Barf,

Barf wrote:
IrScrutinizer 1.0.0's "Arduino capture interface" expects the Arduino to spit out strings like
f=38095 +14875 -11562 +14750 -11562 +14750 -11562 +14750 -11562 +14750 -11562 +14750 -11562 +14750 -11562 +14750 -11562 +14750 -11562 +14750 ... -200000[/code]


I can adapt to this format for all capture types except for the direct USB output, because the Arduino is not fast enough for doing the formatting in realtime, so the post processing needs to be done on the PC.

Barf wrote:
This is the "aggregate form".

Can IrScrutinizer also handle the non-aggregate form?

Barf wrote:
Also note that the number of durations is even, the last one being the final silence, which happens to be identical to the preset ending timeout.

No problem, I can add this dummy value to the end of the output.

Barf wrote:
So, for the short time solution, if you can have your sketch outputting this format, IrScrutinizer 1.0.0 unmodified will take it directly. (Ohh, 9600 baud hard soldered in... Embarassed )

The native USB interface on the Arduino Leonardo doesn't care about the baudrate setting because there is no UART interface between the PC and the ATmega. Only the FTDI converters use this setting for their UART interface to the ATmega.

Barf wrote:
For other forms than the "aggregated", it is definitely interesting to be able to analyze signals in that detail, however, I think it is probably better to us programs like Matlab/Labview/Octave/Gnuplot or a spreadsheet program for doing the analysis. What do you think?

What's the real world usecase? Who needs to do the capture and who will analyze the waveform?

Barf wrote:
Finally, would you consider changing your license (GPL2) to e.g. "GPL2 or later"? Since IrScrutinizer is "GPL3 or later", it would make things simpler.

No problem for my own code.

I've to leave for today and answer the rest later...

Michael
Back to top
View user's profile Send private message
MikeT



Joined: 28 Oct 2010
Posts: 115

PostPosted: Mon Feb 10, 2014 4:07 pm    Post subject: Reply with quote

Barf wrote:
For the long time perspective: I wrote down my ideas of a modular, general IR server for sending, receiving, capturing. What do you say?

I really like the idea of a general purpose IR box on the network which can be controlled via a mobile phone. There are WiFi and LAN shields for the Arduino but it might be easier to use a real server.

Barf wrote:
Have you had a look at the Intel Galileo?

The only thing I know about it is that it is a 486. GPIO access can only do 230 Hz (not kHz !). For hard real-time requirements you additionally need dedicated hardware like the ATmega32U4.

The Arduino Tre might be a nice board because it has an ARM Cortex-A8 and ATmega32U4 chip, so it can run a network server and do realtime IO.

I would probably prefer a combination of a Raspberry Pi or Beagle Board and a ATmega board. The Pi and the Tre have a HDMI output which is very useful.

Michael
Back to top
View user's profile Send private message
Barf



Joined: 24 Oct 2008
Posts: 682

PostPosted: Sun Feb 23, 2014 10:12 am    Post subject: Reply with quote

I did a few minor changes, in particular to the output format, #ifdef-ed out stuff not needed for IrScrutinizer. The final outcome, as a new version of IrScrutinizer, called 1.0.1 was uploaded. I also removed some files not needed (here), and renamed the .cpp file to .ino. (Sorry, I was not motivated to go through the work of getting your makefile to work... ) I have tested with an Uno, a 10 Chineses Nano-clone, and with the Mega 2560; all worked fine (using 115200 baud). I am using the sensor OPL551 for the first two, and a QSE159 (with hardware pull-up) for the Mega. Without having tested extensively: it appears to capture very reliably and exactly, subjectively better than the IrWidget. I also made some modifications to IrScrutinizer, in particular the baud rate is now user settable, and even saved in the program preferences (.i.e. between sessions).

Some comments:

- I put the hardware pull-up in #ifdef ENABLE_PULL_UP since I think it is better optional and selectable. (I have just bought 10 OPL551...)
- Would it be possible to make the used pin settable?
- I had to add a "dummy" gap at the end of the output, since IrScrutinizer expects Ir sequences to end with a gap. Logically, this should be the ending timeout: "logically", since we just detected a period of silence of exactly that duration, then we did not to wait any longer. Although your selected value now appears reasonable, I could not find it in the code. Ideally, it should be settable. Also, the initial timeout and the maximal signal length (as long as not limited by the allocated memory) should ideally be settable, or at least easy to read out.

Finally, thanx a lot for this cool piece of software!! Very Happy

Edit (2014-06-28): version 1.0.1 has been deleted, since obsolete. Please use the current version instead.


Last edited by Barf on Sat Jun 28, 2014 5:17 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
MikeT



Joined: 28 Oct 2010
Posts: 115

PostPosted: Tue Feb 25, 2014 4:04 pm    Post subject: Reply with quote

Barf wrote:
I put the hardware pull-up in #ifdef ENABLE_PULL_UP since I think it is better optional and selectable.

Normally the 20 to 50 kOhm pullup won't hurt even when not using an open collector output.

Barf wrote:
Would it be possible to make the used pin settable?

There is not much choice for the pin. The ATmega328 only has one ICP pin, the ATmega32U4 has two and the ATmega2560 has four (but only two can be used in the Arduino Mega). Each of these ICP<n> pins is directly bound to a specific timer <n> so when changing the pin also the corresponding timer has to be selected. This can be done by setting the #define CAP_TIM to <n> and adapting the CAP_PORT and CAP_PIN accordingly.

[quote="Barf"]I had to add a "dummy" gap at the end of the output. Although your selected value now appears reasonable, I could not find it in the code. Ideally, it should be settable.[quote="Barf"]

It is hidden in the following line:
Code:

      if(ovlCnt >= (_BV(RANGE_EXTENSION_BITS) - 1))


This means "when the number of timer overflows is greater than 2^numberOfBits reserved for the range extension" so the value cannot be stored in a single 16 bit word.
To calculate the timeout value just call clocksToMikroSeconds(unpackTimeValSwapped(0xffff))

Instead of using (_BV(RANGE_EXTENSION_BITS) - 1) you can also use a smaller value to reduce the timeout.

Barf wrote:
Also, the initial timeout and the maximal signal length (as long as not limited by the allocated memory) should ideally be settable, or at least easy to read out.

The initial timeout is infinite which means the capture doesn't have to be started explicitly. It just starts with the selected mode and keeps looking for either an IR edge or a command on the serial line.

The maximum length could be easily set using a command and except for the direct USB capture for the Leonard it wouldn't cost extra time. I still don't understand the use case. Why don't you just release the key on the remote control or cut off the non-wanted data instead of limiting the capture?

Michael

PS: At work I'm developing a software which has dozens or even hundreds of settings nobody understands. So I want to avoid any setting that not even I can understand or explain. Most users are happy with reasonable defaults.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic       JP1 Remotes Forum Index -> JP1 - Software All times are GMT - 5 Hours
Goto page Previous  1, 2, 3, 4, 5  Next
Page 3 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

Powered by phpBB © 2001, 2005 phpBB Group
Get Smart! the band's official homepage Rockabilly Central