|
ATTINY85-20PUMicrochip Technology
|
x 1 | |
|
PN2222ABUonsemi
|
x 2 | |
|
CF18JT220RStackpole Electronics Inc
|
x 2 | |
|
UMK212B7104KG-TTAIYO YUDEN
|
x 1 | |
|
CF18JT12K0Stackpole Electronics
|
x 1 |
|
Arduino IDE |
RC signal decoder switch
For RC boat I wanted to switch on/off the lights.
I also wanted a second light or smoke machine to be turned on on the second position.
I used the attiny to decode the signal that is a 1, 1.5 or 2 seconds long pulse.
If the first position (1 second) is selected all outputs are off
If the second position (1.5 seconds) is selected the first output (A) is on.
If the third position (2 seconds) is selected both outputs (A+B) are on.
The sketch is in the attachment.
To program the ATTINY you can use a arduino UNO for flashing.
If you have a programmer you still may need the UNO to first flash a bootloader on there.
I recommend using optiboot without USB. With USB it only works if it's USB connected because it tries to sync the clock.
It is important to first power on the circuit before turning on the RC-transmitter.
I've noticed that with the RC-transmitter turned on first the ATTINY may not start the program. (this has to do with the fact that the reset pin is used as an input pin and connected to rc-receiver)
Shorting pin 2 to ground a moment can also fix this but that's not ideal.
int duration
// ch4 in first (left) position all off
// ch4 in second (middle) position A on
// ch4 in third (right) position A & B on
void setup(){
pinMode(3, INPUT);
pinMode(4, OUTPUT);
pinMode(1, OUTPUT);
}
void loop() {
duration = pulseIn(3, HIGH);
if (duration < 1300) {
digitalWrite(1, LOW);
digitalWrite(4, LOW);
} else if ( duration > 1700 ) {
digitalWrite(1, HIGH);
digitalWrite(4, HIGH);
} else {
digitalWrite(1, HIGH);
digitalWrite(4, LOW);
}
}
RC signal decoder switch
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Edwin Ringersma
-
-
-
-
-
-
3D printed Enclosure Backplate for Riden RD60xx power supplies
154 1 1 -
-