Hi all, i have put this post together as i couldn't find the answers out
there and so had to figure it out myself. So i hope this information
might be of help to someone in the future.

I have a Raspberry PI with the latest v7 PiCore + 3.5" touchscreen +
Jivelite + IR receiver. All works nicely, but i wanted to use it with my
NAD 320BEE amplifier. Now the problem is, this amplifier (as many do)
enters a power-down state after mains power is applied and I have an
Alexa-controlled socket powering both the Pi and the amp, so i can turn
them off eg overnight. I didn't then want to have to dig the amp remote
out just to turn the amp on to fully powered mode every time i use it.

Incidentally, the AMP has an 'IR-in' socket and I can confirm that the
3.3v gpio which drives the IR LED will also work when directly plugged
in - the signal in the socket is expected to be modulated exactly the
same as that which supplies the LED (I checked on the NAD schematic) and
the 3.3v range is sufficient to control the amp.

LIRC TESTING
It took me all of 5 minutes to test this with an IR-LED i had connected
to GPIO-5 and using LIRC with this config file:
http://lirc.sourceforge.net/remotes/nad/SR6
> #
> # this config file was automatically generated
> # using lirc-0.8.3(default) on Wed Nov 26 13:31:18 2008
> # contributed by Amigac
> #
> # brand: NAD # model no. of remote control: SR6
> 
> begin remote
> name  NAD_SR6
> bits           16
> flags SPACE_ENC|CONST_LENGTH
> eps            30
> aeps          100
> header       9038  4332
> one           675  1556
> zero          675   454
> ptrail        662
> repeat       9064  2113
> pre_data_bits   16
> pre_data       0xE13E
> gap          107932
> toggle_bit_mask 0x0
> begin codes
> KEY_POWER                0xA45B                    #  Was: on
> off                      0x13EC

IR-TOOLS AND IR-CTL
However, when i installed Jivelite and set up the kernel IR-tools - no
dice!
Long story short; after some input from Ralphy and others, it seems LIRC
and IR-tools are mutually exclusive. So i did a lot of digging and
discovered that within the set of 'IR-tools' there is a utility called
ir-ctl:
ir-ctl is described quite aptly as "a swiss-knife tool to handle raw IR
and to set lirc options" -
http://manpages.ubuntu.com/manpages/bionic/man1/ir-ctl.1.html

Note : I had already set gpio-5 as the lirc output in the tweaks - IR
section even though i was not using lirc - i think you need to do this
so as to add the following line to 'config.txt' :
dtoverlay=gpio-ir-tx,gpio_pin=05

With no additional extensions or add-ons you can just try it out on the
command line: -ir-ctl -f - should give you this:
Receive features /dev/lirc0:
- Device cannot receive
Send features /dev/lirc0:
- Device can send raw IR
- IR scancode encoder
- Set carrier
- Set duty cycle

I guess the receive function is already occupied (by jivelite) - but
transmit is all ready to go. There are a range of options, but rather
than create a custom binary file, we want to keep it simple and i had
already verified the above keycodes from the LIRC conf file.
Fortunately, i had a scope to hand and so i was able (spent several
hours trying) to figure out which protocol and sequence the NAD amp
uses.

Note to all; the NEC and NEC extended protocols (which were relevant to
me) do seem to be very popular, but there are many others too (all
supported by ir-ctl). It is the protocol which defines all the
mark-space ratio, delay between header and command etc etc - this is the
purpose of the first section of the lirc.conf file shown above. However,
all i wanted was the Manufacturer's code (aka pre-data above) - 0xE13E
and the specific keycode for power on - 0xA45B !

Just in case this helps you out - here is the full plot from my scope
from the reference remote (NAD SR5):
34708

The carrier frequency for both NEC protocols is 38KHz, which is the
default anyway for IR-tools and is generally most popular. Here is some
more info: https://www.sbprojects.net/knowledge/ir/nec.php

After the low / high header, there are 4 x 8 bit fields: corresponding
to the 16 bit manufacture's address and an 8 bit keycode followed by 8
bits binary inverse of the keycode for robustness -> that means NEC
extended (NECX)
Alternatively, if the manufacturer's address were only 8 bits, then we
would have 8 bit manufacturer code + 8 bits binary inverted manufacturer
code + 8 bit keycode followed by 8 bits binary inverse of the keycode ->
that would mean NEC regular (NEC)

>From this and the description of the NEC Extended protocol (16 bit
manufacturer code) - i realised that although the 'on-air' sequence
yields: E13E A45B, in order to get this you need to send (via ir-ctl)
lsb first for each byte, so the required hex code is 0x877C25. In order
to use key scan codes, we need to use option -S, which requires the
argument 'PROTOCOL:SCANCODE' as follows: 
sudo ir-ctl -S necx:0x877C25

Each of the bytes above, if converted to binary and swapped lsb to msb
will then match the bytes below !

This results in the following bit sequence from the IR LED:
11100001 | 00111110 | 10100100 | 01011011
E1            | 3E            | A4            | 5B
Addr Lo    | Addr Hi      | Cmd         | Cmd inverted

Last step then is to add the above command to one of the User command
entries on the tweaks page of your piCore web gui

I now have a fully working AMP control solution right from piCoreplayer
and, in fact i could send any of the remote codes i want (although i
will have to figure out how to add some user commands to the squeezlite
menu - e.g. switch input on the AMP for radio ?!

As i say, I hope this info is helpful for someone out there !

Cheers

Chazza


+-------------------------------------------------------------------+
|Filename: Picture1.jpg                                             |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=34708|
+-------------------------------------------------------------------+

------------------------------------------------------------------------
chazza's Profile: http://forums.slimdevices.com/member.php?userid=64267
View this thread: http://forums.slimdevices.com/showthread.php?t=114597

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to