Using the IR Receiver
Clone this wiki locally
What you need:
- 1x TSOP31238 IR-Receiver module
- 1x Capacitor > 0.1µF
- 1x Resistor between 33Ohm and 1kOhm
- 1x IR Remote using the NEC protocol
Now build the following circuit:
And finally wire the circuit to your Hexabus board:
- Connect "IR1" to PIN 9 on the ST1 header (Ground)
- Connect "IR2" to PIN 42 directly on the ATmega (See picture)
- Connect "IR3" to PIN 10 on the ST1 header (VCC)
First, activate the IR-Receiver by setting "IR_ENABLE" in the
firmware/contiki-2.x/platform/Hexabus-Socket/hexabus_config.h to 1. Then set "IR_RECEIVER_RAW_MODE" to 1.
If you are using a Samsung remote set "IR_SAMSUNG" in
firmware/contiki-2.x/platform/Hexabus-Socket/apps/ir_receiver/ir_receiver.h to 1, if not set it to 0.
Now build and flash the image.
hexaswitch listen and push the buttons on your remote you want to use. Note down the broadcast values.
Open the the
ir_receiver.h again and set the defines for IR0 to IR31 to your noted values. This maps the codes specific to your remote to a generic 32bit vector, so you don't have to change every state machine in your hexabus network if you change your remote.
Finally disable "IR_RECEIVER_RAW_MODE" in the
hexabus_config.h and build and flash the image again.
The Repeat option
hexabus_config.h is set to 0, rapidly repeated codes from your remote (caused by holding down a button) are filtered to prevent flooding the network.
Sometimes this behaviour is desired for some buttons, so you can activate it by setting "IR_REPEAT" to 1 and configuring the "IR_REPEAT_MASK" in
ir_receiver.h by setting the bits corresponding to the buttons you want to be repeated to 1.