3
\$\begingroup\$

I think most of you know these cheap rgb-strip-controllers with ir-remote. I try to control it via hardwired gpio from raspberry3, simply replacing the ir-receiver.

from

|ir remote|.......>...|IR-LED GP3 µc|

to

|rpi GPIO out|----->----|in GP3 µc|

I found these informations about the box:

12 V In 
SMD5050 RGB Strip 4Wire
SOT23 NFET, max 3A
IR Sensor CHQB, 3Wire 
8bit 8pin µc with 5V TTL Logic
at least 3x PWM
maybe PIC12F617

Pinout on this µc:

        GND - XX - 5V
        GP5 - XX - GP0 - B Out
        GP4 - XX - GP1 - R Out
IR IN - GP3 - XX - GP2 - G Out

http://ww1.microchip.com/downloads/en/DeviceDoc/41388A.pdf

opened rgb-ir-controller

Is it possible?!

  • 1. controlling via wired GP3 (IR)-Port?

    • Seems, the carrier-demodulation (35KHz) is inside the ir-receiver.
    • How do i have to encode/recode the ir-data to be understood by the µc?
    • Is it a simple pseudo-serial-in-port with a distinctive baudrate?
    • clearly saying "i want to bypass the ir-path"
    • benefit short commands and no hustle on raspberry
    • disadvantage only able to use µc-saved commands
  • 2. connecting directly to the NFET (Q1-Q3 on picture)?

    • Do i have to level-shift 3,3V to 5V?
    • benefit all is possible
    • disadvantage need to code it all on raspberry
\$\endgroup\$
3
\$\begingroup\$

Both are possible.

IR, first you need an IR receiver setup. Record the signal incoming from the remote. Then setup a simple IR led circuit controlled by a transistor/FET controlled by GPIO. Send the commands you want. It is not pseudo serial, the codes tend to be NEC (Maybe RC5, but NEC is simpler and more common). Any number of IR RPi remote control projects on google will help.

The hard wire, remove the existing IC. Use a level shifter as 3.3V will likely not be enough to exceed the VGS Threshold for a proper low Resistance of Drain-Source, RDS(on). This shift can be a simple npn transistor, but it requires you to invert your logic on the RPI code.

Update:

Yes, you could bypass the IR Receiver. It is as you expect, a Demodulator that removes the 38khz (or so) carrier wave, and passes the data. I believe it should be an active high signal through a pull-up. This allows you to skip the LED transmitter and IR receiver sections. Since the line should have a 5V pull up, all you need is a simple NPN transistor to level shift from 3.3V to 5V. Again, logic is inverted so a logic 1 at the RPI would be a logic low at the MCU input. You must make sure only the data, Unmodulated is sent.

Since you are using LIRC for the RPI, then you need to load it properly:

 sudo modprobe lirc_rpi softcarrier=0

The Softcarrier option disabled to eliminate the carrier wave, only available on lirc_rpi afaik, so you lucked out.

This depends on the specifics of the IR receiver used. A picture of the reverse of the board would help. You would want to disconnect the IR receivers Data to avoid interference.

\$\endgroup\$
  • \$\begingroup\$ updated the question. my main goal was to hardwire from Raspberry-GPIO to the GP3 (IR)-Port. but i dont know if i have to send modulated RC5/NEC-Commands (because the demodulation is inside the ir-receiver) or what else. \$\endgroup\$ – chmee Aug 16 '16 at 17:38
  • \$\begingroup\$ @chmee updated. Also a picture of the other side would help as would the IR receiver \$\endgroup\$ – Passerby Aug 16 '16 at 21:57
  • \$\begingroup\$ The backside of the pcb is empty. The IR-receiver is only connected with the upper 3 cables Green=VOUT Red=VDD Black=GND. Thanks for your insight. This time i could fulfill the wishes with soft-PWM and connecting to the N_FET. \$\endgroup\$ – chmee Aug 16 '16 at 22:02
  • 1
    \$\begingroup\$ @chmee slight error. I said RC5, it's most likely NEC protocol. And when you attempted to send the data directly, did you disable the modulation? What library did you use? \$\endgroup\$ – Passerby Aug 17 '16 at 1:05
  • 1
    \$\begingroup\$ @chmee also found info on disabling the carrier on lirc_rpi. Try that option again. \$\endgroup\$ – Passerby Aug 17 '16 at 1:14
3
\$\begingroup\$

(1) replacing IR through wire

  • I had no luck getting it to work. While raspberry/lirc recognised the ir-signals from the remote, nothing happens when i send these data via wire to the GP3 of the µc. Good news, this IR-Receiver is working with Raspberry/Lirc as well.

  • Please read the answer by @Passerby.

lircd.conf example

# brand:         /home/pi/lircd.conf
#  
# -- it seems, this controller was built with many
# -- different commands. i ve got 5 at home and only two
# -- remotes/controllers are working with these commands
#
# usage  irsend SEND_ONCE LED LED_ON

begin remote

  name  /home/pi/lircd.conf
  name LED
  bits           16
  flags SPACE_ENC|CONST_LENGTH
  eps            30
  aeps          100

  header       9029  4479
  one           594  1651
  zero          594   530
  ptrail        592
  repeat       9029  2239
  pre_data_bits   16
  pre_data       0xF7
  gap          107958
  toggle_bit_mask 0x0

      begin codes
          LED_ON                   0xC03F
          LED_OFF                  0x40BF
          LED_BRIGHT               0x00FF
          LED_DARK                 0x807F
          LED_R                    0x20DF
          LED_G                    0xA05F
          LED_B                    0x609F
          LED_W                    0xE01F
          LED_FLASH                0xD02F
          LED_STROBE               0xF00F
          LED_FADE                 0xC837
          LED_SMOOTH               0xE817
          LED_RB                   0x48B7
          LED_RG                   0x28D7
          LED_BG                   0xA857
      end codes

end remote  

(2) Connection to the SOT23 N-FET

  • Works like a charm. I cutted the gpio from the µc, soldered 4 Cables and connected them to the raspberry, without a levelshift to 5V. First Tests went fine.

soldering cables on cheap ir led controller

python example:

import time
import RPi.GPIO as GPIO

pinR = 27
pinG = 17
pinB = 22
pwmFreq = 200

GPIO.setmode(GPIO.BCM)
GPIO.setup(pinR, GPIO.OUT)
GPIO.setup(pinG, GPIO.OUT)
GPIO.setup(pinB, GPIO.OUT)

pr = GPIO.PWM(pinR, pwmFreq)  # GPIO 27 frequency=200Hz
pg = GPIO.PWM(pinG, pwmFreq)
pb = GPIO.PWM(pinB, pwmFreq)
pr.start(0)
pb.start(0)
pg.start(0)

try:
    while 1:
        for dc in range(0, 101, 1):
            pr.ChangeDutyCycle(dc)
            pb.ChangeDutyCycle(dc)
            pg.ChangeDutyCycle(dc)
            time.sleep(0.02)
        for dc in range(100, -1, -1):
            pr.ChangeDutyCycle(dc)
            pb.ChangeDutyCycle(dc)
            pg.ChangeDutyCycle(dc)
            time.sleep(0.02)
except KeyboardInterrupt:
    pass
pr.stop()
pb.stop()
pg.stop()
GPIO.cleanup()
\$\endgroup\$
  • \$\begingroup\$ Good work. Don't forget that you can accept your own answer! \$\endgroup\$ – Transistor Aug 16 '16 at 22:01
  • 1
    \$\begingroup\$ 3.3V may work, but the RDS will be higher and can lead to less current being passed, the fets heating up, and the led strip being dimmer the longer it is (aka the bigger the load). The data sheet for the fets would confirm. \$\endgroup\$ – Passerby Aug 17 '16 at 0:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.