Syma Forum
Welcome to our Syma Forum - Please click on topics to view comments.You have to be a member to post-Free to join. Enter correct email as password will be emailed to you- All Syma Helicopter help and advice here. NEW- you can now change color of forum, bottom of page!
A A APlease consider registering
guest
How is the mod coming along, could you post any of your code?
Sorry, i just noticed that there was a question in the opening post that i overlooked :/
the signal in the RFmod is the same as the one from the transmitter, except the 38Khz modulation has been removed, so you are only left with the data packet.
For anyone interested, i have combined some pieces of code to control the S107(+most other 3ch syma helicopters) from an Arduino using 4 Potentiometers, a resistor, and a IR Led. (to keep things simple, i havent used a transistor, but instead used the Arduino to synk the current instead of source it)
This is the best code I have modified so far, however it seems to be missing the code to transmit the check-sum.
Arduino sketch:
// Connect (+) of IR LED to 5Vcc
// connect (-) to pin 4 with a 100 Ohm resistor in line. For best results make a transistor circuit with external power source.//Potentiometers connected to analog pins 0, 1, 2, 3 (Throttle, Rudder, Elevator, Trim)
#define RED 4 // the output pin of the IR LED
void setup() {
pinMode(RED, OUTPUT); // set IR LED (Pin 4) to Output
int ThrottlePin = A0; // select the input pin for the potentiometer
int RudderPin = A1; // select the input pin for the potentiometer
int ElevatorPin = A2; // select the input pin for the potentiometer
int TrimPin = A3; // select the input pin for the potentiometer
int Channel = 0; //Channel A = 0, Channel B = 128
}
void loop() {
//Do you magic here. The code directly below just throttles up to 60 and back down to 0.
//You can get data from the serial port, a joystick, or whatever. You just need to translate your input into values between 0 and 127.
//Pass those values to Transmit( ) as an integer between 0 and 127 and that's it!
int Throttle, Rudder, Elevator, RudderTrim;
int Channel;
Throttle = analogRead(A0)/8 + Channel; //Divide by 2 for difference between CHA and B, Divide by 4 to convert from 10Bit to 8Bit
Rudder = analogRead(A1)/8 + Channel;
Elevator = analogRead(A2)/8 + Channel;
RudderTrim = analogRead(A3)/8 + Channel;
Transmit(Rudder, Elevator, Throttle, RudderTrim);
} //End loop()
void Transmit(byte rudder, byte elevator, byte throttle, byte trim) {
static byte Code[4];
byte mask = 128; //bitmask
int i;
Code[0] = rudder; // 0 -> 127; 63 is the midpoint.
Code[1] = elevator; // 0 -> 127; 63 is the midpoint.
Code[2] = throttle; // 0 -> 127; 0 is throttle off
Code[3] = trim; // Haven't messed with this
OutPulse(2002); // Start 38Khz pulse for 2000us (2002us is evenly divided by 26)
delayMicroseconds(2000); // 2000us off.
for (i = 0; i<4; i++) { // Loops through the Code[]
for (mask = 128; mask > 0; mask >>=1) { // See Arduino reference for bit masking (really cool stuff!)
OutPulse(312); // Sends 312 pulse each loop
if(Code[i] & mask) { //If both bit positions are 1 you get 1
delayMicroseconds(688); // send 1 (700 off)
}
else {
delayMicroseconds(288); // send 0 (300 off)
}
} //End mask loop
} //End i loop
OutPulse(312); //Send 300 microsecond Closing Pulse
delay(60);
} // End Transmit
void OutPulse(int Pulse) { //sends 38Khz pulses over the Pulse Length
int p;
for(p = 0; p < (Pulse / 26) - 1; p++) { //Takes about 26 microseconds per loop
digitalWrite(RED, HIGH);
delayMicroseconds(10);
digitalWrite(RED, LOW);
delayMicroseconds(10);
}
} //End OutPulse
I was just wondering how you are getting on with this mod.
I assume that you are probably going to try and use the accelerometer for the pitch, and the analogue stick for the throttle and steering. If you need any example code, take a look here
I now have an Arduino Uno and nano, so i have started building projects around them.
Personally i USED to be a PIC Kid, but now that i have an Arduino i cant believe how easy it is to code, (absolutely no assembly language), i don't think i will be going back to PIC for larger projects. (they still have their uses for on/off switches and small stuff)
But I digress, This project could allow a person to fly a S107 with one hand, i.e This instructable
The project could also easily be adapted to allow a person to use a Full scale hobby TX (with a trainer port) to control a S107. (not my image, but it is what has already been done)
Or just go strait to making a custom transmitter, by reading 3 ADC channels for the control, and 1 ADC for the battery voltage monitor. (could be placed in standard S107 transmitter, and then program in extras like dual rates, channel reversal, etc)
p.s. if you still need an ausciloscope, you can make one (for free) that uses your PC's sound card.
I was thinking about starting a thread on how to make a PC osciloscope, but as ive not got around to doing it yet, heres a link to one http://www.ledametrix.com/osco.....index.html and use the software from http://www.zeitnitz.de/Christi...../scope_en/
That is what i used to use, before getting my "DSO Nano DSO201 Pocket-Sized Digital Oscilloscope"
Ok, as a wii call of duty kid, I went from "Ok, annother electronics thread that I'm over my head in and it's all gigliboosh to me" to "Ok, this is really cool and interesting."
I'm guessing up will be Z, down C, turn l/r would be l/r on the stick and fwd/bwd would be fwd/bwd on the stick. Just not sure about the trottle exactly...
Do you have a video of the other person't idea? That'd be cool to watch for us laymen!
Yeah I had read that and it really helped me out. But I realized that an ir receiver is just a NPN transistor and so I just used a NPN and a couple resistors to pull(up?/down?...cant think...too late) to make it a nice square wave!
My project is a wii nun chuck with an attiny85 and RF transmitter inside that controls the S107g. I was inspired by somebody else who made one for another brand rc heli. I'll post the plans up in a couple days!
Waa, I could have sworn I responded to this post.....
Anyway, welcome to the forum, I hope you enjoy your time here.
From reading your post, I assume that you have read the IR protocol thread over at RCGroups to get your code fully working.
To answer your question, the IR receiver removes the 38kHz carrier signal, and inverts the signal (High=0, Low=1)
Funny thing... just saw an old like 60's oscilloscope at a flea marker last weekend. Lol.
Didn't think there was much use for them anymore besides
Hope everything goes well! Lots of electronics mods now--used to be almost exclusivly mechanical or electric mods. (electric as in different batteries and wiring, not swapping out transmitters and etc)
So basically I have my S107g controlled from my arduino that switches a transistor (I don't plug the IR led straight into the arduino because it can only put out 40ma through its digital pins) at 38khz to send IR signals to the heli based on the input of a nun chuck.
I have it working great but its annoying to have to carry the Arduino in one hand and hold the nunchuck in the other. Also, the range is pretty crappy. So my plan is to put an ATtiny85, a RF transmitter and a lipo inside the nunchuck and put the RF receiver on the heli. Right now i have the ATtiny85 running a modified boot loader so it clocks at 16mhz(so delay microseconds() will work) and it will control the heli. I am working on getting the I2C communication with the nunchuck to work but thats irrelevant...
Basically, i'm using the general concept that raptor used in his RF mod but i'm trying to figure out how the heli receives data from the ir receiver. I know how to pulse the ir led but i want to connect the transmitter directly to the arduino instead of having to pulse the led and connect the receiver to the transmitter.
I don't have and oscilloscope so i can't really figure out how the data is changed by the ir receiver.
Andrew
Most Users Ever Online: 211
Currently Online:
8 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
MikeK: 178
SymaGuru: 32
justdon: 9
nope: 5
smith: 2
groggy: 2
Member Stats:
Guest Posters: 729
Members: 20
Moderators: 0
Admins: 2
Forum Stats:
Groups: 7
Forums: 16
Topics: 1283
Posts: 8215
Newest Members:
Administrators: Syma Freak: 1452, JamDJ: 264