Show Posts
Pages: 1 ... 6 7 [8] 9 10 ... 18
106  Community / Exhibition / Gallery / Re: BlueCopter - Arduino Quadcopter on: September 08, 2013, 10:26:04 am
smiley-grin i was wrong after i change the throtle on radio and signal never changes and when i unpluged the receiver the signal i had signal from pin 11 still like befor showing on scope

ya because you changed the interrupt pin number.. And why did you put pinMode (YOUR_OUTPUT_PIN, OUTPUT); in the interrupt routine??? You only have 2 interrupts on the UNO.. They have the numbers 0 and 1 and are located on pins (2 and 3).. so in the code change the number 3 to a 1 and leave everything as is.. I've fixed the sketch for you... Here is the code, just copy paste and run it..

Code:
#define RX_INT_PIN_THROTTLE 1
#define YOUR_OUTPUT_PIN 11


volatile int rxPrev = 0; //variable that will contain the previous time
volatile int rxVal = 0; //variable that will contain the current throttle pulse length



void rxGoesHigh(){
/* As soon as we get into this function we measure the current time (with micros)
and put that value in our variable rxPrev. After that we re-attach the same interrupt
but this time we want it to fire when the pin goes low "FALLING". When that happens it
will call the function rxGoesLow */
  rxPrev=micros();
 
  attachInterrupt(RX_INT_PIN_THROTTLE,rxGoesLow,FALLING);
}
void rxGoesLow(){
/* As soon as we get into this function we measure the current time (with micros) and
subtract the previous time (rxPrev). By doing that we will get the length of the pulse,
from start to the end. We end this process by re-attaching the throttle pin to a RISING
interrupt, which will repeat the process again... */
  rxVal=micros()-rxPrev; 
  attachInterrupt(RX_INT_PIN_THROTTLE,rxGoesHigh,RISING);
 
}

void setup(){
pinMode (YOUR_OUTPUT_PIN, OUTPUT);
attachInterrupt(RX_INT_PIN_THROTTLE,rxGoesHigh,RISING); /*We begin by attaching a interrupt
to the throttle pin. the interrupt will fire when the pin goes high "RISING" (meaning the
start of the pulse). When that happens it will call the function rxGoesHigh.*/
}
void loop(){
//Nothing to do here!
int out = map(rxVal,1000,2000,0,255);
analogWrite(YOUR_OUTPUT_PIN,out);
}



Edit: If this still doesn't work for you, I need you to show me how you hooked everything up.. Just draw a simple schematic.. And can you give me the name of your receiver/transmitter??? Just want to check and make sure that it's really PPM we are talking about..

//Basel
107  Community / Exhibition / Gallery / Re: BlueCopter - Arduino Quadcopter on: September 08, 2013, 02:53:34 am
Quote
tnx . i will be great because this code is just for one channel and im sure i f go to edit this i will screw the code and everything go wrong smiley-grin .

Sure I can write the pin-change-interrupt explanation, but I'm going to use my quadcopter code as an example (Arduino Leonardo).. Meaning it won't work on the UNO... If you only got 4 channels you can go with a Arduino Leonardo (it has 5 external interrupts) or Arduino Mega (has 6 external interrupts) and reuse my example code that I posted above... if you don't want to buy another board you can use this library which makes PC-Interrupts look like a walk in the park..The library for the pin-change-interrupts will simplify a lot and make the code look like the example I posted..
Here is the library: https://code.google.com/p/arduino-pinchangeint/

and some another question in this code we dont have any output pin ?

Well, no, because it's too simple really.. Here is a example of how to output PWM (combine this code with the previous example and give it a go)..

Code:
#define YOUR_OUTPUT_PIN 11
void setup(){
pinMode(YOUR_OUTPUT_PIN,OUTPUT);
}
void loop(){
int out = map(rxVal,1000,2000,0,255);
analogWrite(YOUR_OUTPUT_PIN,out);
}


But seriously, you clearly need to read and look at the different examples/tutorials in this forum and out there(internet of things).. I wouldn't mind writing the whole thing for you, but that won't teach you anything!

If you'd like, write your sketch and try it out and in-case it doesn't work and you've tried everything you can, post it here.. We would be more than happy to help you out..

//Basel
108  Using Arduino / Project Guidance / Re: Arduino Science Fair on: September 07, 2013, 06:22:59 pm
<thinking oout of the box >
create the smartest doorbell possible, one that recognizes the length of the press, how hard it was pressed, temperature of the finger, the pattern, movements while pressed, whatever is measurable to identify the person....

Can you enter a secret code with a simple doorbell to open the door?
What else can be controlled by a doorbell? garage, lighting, garden sprinkler ...

Looll!! Sprinkler controlled by a doorbell, that would be funny! haha, but seriously bro, very fun ideas!
109  Using Arduino / Project Guidance / Re: arduino quadcopter and ppm receiver ( none sum ) on: September 07, 2013, 05:59:24 pm
im so weak in programming and coding smiley-sad . there is so many codes to read ppm but they are not complete ... i want somthing to read 4 channel in ppm and output ppm-sum or 4channel in pwm mode . its my university final project smiley-sad

No, I'm not used PPM-sum.. I'm using ordinary servo signals/PPM, one pin for each signal, and outputting PWM.. I know programming is not your strong side, but because it's a University project you need to scratch your head for some time and read, read and read... Anyhow I just answered your question in my thread (with example code YAYYY), hope you find it helpful.. http://forum.arduino.cc/index.php?topic=184503.0

Good luck!  smiley
//Basel
110  Community / Exhibition / Gallery / Re: BlueCopter - Arduino Quadcopter on: September 07, 2013, 05:13:47 pm
For RX (receiver), PPM signal (Pulse-position modulation), The pins are as follows:
you mean ppm receiver work with your code ?

Yes, the receiver sends ordinary servo pulses/PPM to the arduino (one signal per axis/control-rod, a total of 6 pins/signals). And because the signals are ordinary servo signals (50Hz update rate), I used interrupts in order to read these when they change and thus avoid getting my loop rate (~800Hz) draged down by these signals..

Here is a example of how these signals looks like:



Edit: I just read your other post about needing a code that reads PPM. I'll try to explain how I did it code-wise:

Let me begin by stating the problem ahead.. If we take the throttle-rod as an example, when the throttle-rod is in the (0% position) the receiver will send a signal that's ~21ms long (a high pulse for 1ms and a low pulse for 20ms).. And when its in the (100% position) the receiver will send a signal that's ~22ms long (a high pulse for 2ms and a low pulse for 20ms).. As you noticed the 20ms part is just a "synchronization part" and doesn't provide anything useful in our case..

What we need is to measure how long the "high pulses" are. And to do that we need to know when a pulse starts and when it ends. The simplest way of doing this is using External interrupts (very few pins on arduino!!)..

Here is a example code:

Code:
#define RX_INT_PIN_THROTTLE 0
volatile int rxPrev = 0; //variable that will contain the previous time
volatile int rxVal = 0; //variable that will contain the current throttle pulse length

void rxGoesHigh(){
/* As soon as we get into this function we measure the current time (with micros)
and put that value in our variable rxPrev. After that we re-attach the same interrupt
but this time we want it to fire when the pin goes low "FALLING". When that happens it
will call the function rxGoesLow */
  rxPrev=micros();
  attachInterrupt(RX_INT_PIN_THROTTLE,rxGoesLow,FALLING);
}
void rxGoesLow(){
/* As soon as we get into this function we measure the current time (with micros) and
subtract the previous time (rxPrev). By doing that we will get the length of the pulse,
from start to the end. We end this process by re-attaching the throttle pin to a RISING
interrupt, which will repeat the process again... */
  rxVal=micros()-rxPrev; 
  attachInterrupt(RX_INT_PIN_THROTTLE,rxGoesHigh,RISING);
}

void setup(){
attachInterrupt(RX_INT_PIN_THROTTLE,rxGoesHigh,RISING); /*We begin by attaching a interrupt
to the throttle pin. the interrupt will fire when the pin goes high "RISING" (meaning the
start of the pulse). When that happens it will call the function rxGoesHigh.*/
}
void loop(){
//Nothing to do here!
}

Begin by reading the comments in setup, then go to the function rxGoesHigh and continue to the function rxGoesLow. Because interrupts are handling your pulse-length changes, all you have to do to get the latest pulse-length is read the variable rxVal.

If you need to read a lot of pins I can write something similar to explain how you can use PIN-CHANGE-INTERRUPTS instead..
111  Using Arduino / Microcontrollers / Re: Arduino Bootloader on: September 05, 2013, 09:57:06 pm
No, you need to bootload the chip.. You don't have to buy a programmer to do that.. You can do it with your UNO..
Look at this: http://arduino.cc/en/Tutorial/ArduinoISP

//Basel
112  Community / Exhibition / Gallery / Re: BlueCopter - Arduino Quadcopter on: September 05, 2013, 11:40:54 am
i have made quadcopter with arduino uno and gy_80 sensor i have ppm 4channel radio controller and it is not sum every single channel is ppm . i tried to use your program for this but receiver dont work when i want it to fly .....
" when i connect my ppm receiver to single motor with esc radio control work perfectly but when i use it as quadcopter with code does not work
.........
help me plz . help smiley-sad
faramarz.zareian@gmail.com

Well, it won't work, I'd be surprised if it did.. This sketch is written for the arduino leonardo (atmega32u4), meaning it won't work on the UNO directly, specially the receiver part. The receiver is using the PCINT (pin change interrupts), and because there is no built-in library for arduino I had to address the registers directly, the atmega32u4 registers (which is not the same for the UNO atmega328p)..

For a beginner I recommend the use of MultiWii's code (http://www.multiwii.com/software), my code is "kind of" for people that wants to write their own code and needs some starting ground..

Edit: Another thing I would like to add.. If you decide to modify my code to work with your quadcopter, you'd have to make sure that your ESC supports PWM at a frequency of ~480-500Hz... Most ESC are made to only support PPM.. PPM isn't the same as PWM, the signal looks different and in most ESC is made to run on a frequency of 50Hz...

Here is a whole discussion about the difference: http://forum.arduino.cc/index.php/topic,14146.0.html

And if you decide to replace the 480Hz PWM with 50Hz PPM, you'll have a lot of trouble getting the quadcopter to be stable... With a little luck, you'll maybe be able to fly it in rate mode.. Angle/Level mode needs a faster update rate...
113  Using Arduino / Microcontrollers / Re: MCU with JavaScript - espruino on: September 02, 2013, 01:49:05 am
Cr0sh.. You got 'a lot of points' there =P but I'm the kind of hobbyist that loves SMD! I learned electronics back in high school.. After that I haven't touched or did anything with my education until 2.5 years ago when I discovered the AVR microcontrollers.. Well you can imagine, I went from soldering only through hole components to almost only surface mount.. To me, surface mounts are easier to work with (somehow).. They are smaller and makes your project look neat/cool.. It only took me 3-5 boards in-order to develop a technique for soldering these small things.. It's not hard.. And when I prototype and etch my boards at home, I try to put only SMD's on my boards.. That's because I don't have to drill the boards, which saves me a lot of time and money (smaller boards == cheaper).. Anyhow, that's my opinion! =)

Back to the topic: No, Javascript is a horrible idea.. What's the next step after Javascript??? Developing a robot that writes these javascripts for you?? I can only see a lot of bulkiness and dumm code generated from this..

//Basel
114  Using Arduino / Microcontrollers / Re: Just busted 2 capacitors off my Arduino Mega 1280...can you identify them? on: September 02, 2013, 01:28:12 am
Hey,

Doesn't your board work at all without these caps?? Anyhow, looking at the schematic: http://arduino.cc/en/Main/arduinoBoardMega

These are 100nF decoupling caps for the FTDI..

//Basel
115  Using Arduino / Microcontrollers / Re: Arduino uno single sided PCB on: August 31, 2013, 11:46:21 am
And what about this? (I do not know anything about it, I found it by accident)

http://vonkonow.com/wordpress/2012/10/nanino-the-diy-friendly-arduino/

This needs an external USB to Serial adapter in-order to program it.. So no USB on-board...

//Basel
116  Using Arduino / Microcontrollers / Re: Arduino uno single sided PCB on: August 30, 2013, 05:15:15 pm
I'm sorry to say this bro, but, there isn't any DIP/through hole package for the atmega8u2/16u2.. And I really don't know of any chip in DIP package that does USB Serial conversion... You can maybe make something like this guy: http://forum.arduino.cc/index.php?topic=24460.0

He's uses an atmega8 as the USB to serial chip..

//Basel
117  Using Arduino / Microcontrollers / Re: Arduino uno single sided PCB on: August 29, 2013, 07:31:42 pm
hey guyz i wan to make single sided PcB for arduino uno... i have searched it on google and i found only this

http://arduino.cc/en/Main/ArduinoBoardSerialSingleSided3

but this is a serial programmer... i want usb programmer...
does anybody here has USB version of this single sided board??


Depends on what you want.. Do you want the USB on-board or as an external device?? In-case of external then here is a link: http://vonkonow.com/wordpress/2012/10/nanino-the-diy-friendly-arduino/

In-case you want an internal, you got to specify the USB chip.. Do you want a FTDI, or atmega8u2/16u2 like the uno???
118  Community / Exhibition / Gallery / Re: XBMC TableTop controller on: August 29, 2013, 04:58:39 pm
Looks interesting.. Good job btw! I would like to see the guts on this thing.. Do you mind posting some pictures showing the board and such..??

//Basel
119  Community / Exhibition / Gallery / Re: BlueCopter - Arduino Quadcopter on: August 29, 2013, 04:14:01 pm
Do you need an additional device to "bind" or "register" the receiver to the transmitter, or does the one you listed do that?

The packages comes with a transmitter and receiver..

No, you get a 'special' wire that shorts the signal line on the PWR-input to ground (on the receiver).. This will put it in binding mode (Led will start to blink once per second)... In the transmitter all you have to do is hold the bind button and turn it on.. One second later the connection is accomplished, and the led on the receiver will stop blinking =D!

//Basel
120  Community / Exhibition / Gallery / Re: BlueCopter - Arduino Quadcopter on: August 29, 2013, 12:03:20 pm
Well done,

many questions pop up
- how high can it fly?
- how long can it stay in the air?
- what does it do when it looses contact with remote?
- ...

-- Pretty high.. I didn't measure the distance yet.. But it's so high that it starts to look like a small fly in the sky (cant see the orientation of the quad, nothing)..
-- I'm using a double 2200mAh (3 cells, LiPo, coupled in parallell).. It gave me approx. 15min of flight..
-- Well I lost contact with it when I pushed the throttle to the max! (meaning it flew very high).. Nothing special happens.. It will stay leveled in the air until battery begins to run out, and it will descend (depending on the ESC ur using, it can descend slowly(ESC cutting power slowly) or it will suddenly stop (ESC cuts the power alltogether)).

And here's my parts list (all from hobbyking.com):

Item/PartPcs
20CM Male to Male Servo Lead (JR) 26AWG (10pcs/set)
1
Hobby King 2.4Ghz 6Ch Tx & Rx V2 (Mode 2)
1
Turnigy 2200mAh 3S 25C Lipo Pack
2
NTM Prop Drive 28 Series Accessory Pack
4
Hobby King Quadcopter Power Distribution Board
1
NTM Prop Drive 28-26 1350KV / 310W
4
HobbyKing 30A BlueSeries Brushless Speed Controller
4
Hobbyking X666 Glass Fiber Quadcopter Frame 666mm
1
8045 SF Props 2pc Standard Rotation/2 pc RH Rotation (Blue)
1

And consider buying spares of ex. propellers and such (if you're a beginner you'll need it)..

//Basel
Pages: 1 ... 6 7 [8] 9 10 ... 18