Jump to content
Flirc Forums

Raspberry Pi + FLIRC + Apple Remote for Alps Motorized Volume Control


afropper

Recommended Posts

FLIRC is a wonderful thing. 

 

USB DACs disable the volume control on Macs. This is sensible from a perfectionist perspective but obnoxious when it adds to the remote control garden. I decided to hijack 3 of the 7 buttons on an Apple Remote and hook up an Alps motorized potentiometer and a mute circuit. It's in a gutted an old Advent radio with the LEDs wired to show activity.

 

Aside from FLIRC, the big find was pygame, which allowed me to capture the keystrokes without fail. With a tiny shell script, the simple code below runs beautifully as an appliance on powerup without a display or keyboard or network. The added circuitry is just 2 L272M power opamps, a 2N3906 transistor and one J111 J-FET for each channel to be muted. The circuit diagram is scattered on multiple scraps of paper but if you contact me I'll maybe clean it up to post.

 

 

import RPi.GPIO as GPIO
import time
import pygame
pygame.init()
screen = pygame.display.set_mode((100, 100))
# to use Raspberry Pi board pin numbers
GPIO.setmode(GPIO.BOARD)
# setup Volume UP / DOWN pins with LEDs OFF
GPIO.setup(16, GPIO.OUT)
GPIO.output(16, GPIO.HIGH)
GPIO.setup(18, GPIO.OUT)
GPIO.output(18, GPIO.HIGH)
# setup Mute to be Off with LED OFF
GPIO.setup(22, GPIO.OUT)
GPIO.output(22, GPIO.LOW)
MUTED = False
def pulse(pin):
        GPIO.output(pin, GPIO.LOW)
        time.sleep(1)
        GPIO.output(pin, GPIO.HIGH)
#    time.sleep(1)
        return
while(1):
    try:
        # m
        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN and event.key <= 256:
                print event.key, chr(event.key)
                if event.key == 117:
                    pulse(16)
                elif event.key == 110:
                    pulse(18)
                elif (event.key == 50) & MUTED:
                    GPIO.output(22, GPIO.LOW)
                    MUTED = False
                elif (event.key == 50) & (MUTED == False):
                    GPIO.output(22, GPIO.HIGH)
                    MUTED = True
                elif event.key == 27:
                    raise NameError('Quit')
 
    except NameError:
        GPIO.cleanup()
        print "    Normal exit"
        exit(0)
 
 

post-3530-0-47623800-1361758635_thumb.jp

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...