Show Posts
Pages: [1] 2 3 ... 30
1  Using Arduino / Sensors / Re: Arduino Mega 2560 and Interrupts on 53,15,14,10 on: July 11, 2014, 11:33:22 am
I tested in arduino mega 2560 and it works!
However, take care if you need to ise Software Serial library because then you could have problems and library modifications could be required.
2  Using Arduino / Programming Questions / Re: Is it compatible Attachinterrupt and PinChangeInt library? on: June 25, 2014, 06:21:09 am
Thanks @PaulS (one more time) for your time and patience.
3  Using Arduino / Programming Questions / Re: Is it compatible Attachinterrupt and PinChangeInt library? on: June 25, 2014, 05:50:47 am
Thanks for your patience @PaulS

Yes, you are right. However, I am talking about to "disable" because this is what the library say:
// #define NO_PORTB_PINCHANGES // to indicate that port b will not be used for pin change interrupts
// #define NO_PORTC_PINCHANGES // to indicate that port c will not be used for pin change interrupts
// #define NO_PORTD_PINCHANGES // to indicate that port d will not be used for pin change interrupts
The author say that in order to save some bytes, you could "disable" in some way some of the ports you will not use. Of course, I understand that this doesn´t "remove or delete" the normal working of the port, but do not care about any interrupt in any of the pins of this port. (sorry, i see that disable is not the correct word but english in not my mother language and my english vocabulary is not rich enough).

This is why i am asking about to "disable" one of the ports (for example this one containing the pins 0 to 7), but still use the pins 2 or 3 for the sensor i asked about, or an alarm from an rtc or whatever, by the use of normal external interrupts.

It depends on how long you take to determine which pin changed, and what the change was. Pin change interrupt handling is not as fast as external interrupt handling because there are for more of them because they are less discriminatory.
Ok, this is why i want to use the normal external interrupts to measure frequency on a normal external interrupt, but at the same time to activate other interrupts by the use of pin change because i would like conect other kind of pushbuttons to trigger interrupts as well as sensors with a really smaller frequency what i think could not be a problem by the use of this other interrupts.

This is why i am talking about to "disable" the ping change interrupt in the port containing pins 2 and 3, but enabling it in the other ports to have more than only 2 interrupts to connect more things to the board.

Then, if i understand correctly, i do not need to take care. I could use normal AttachInterrupt() on pins 2 and 3, and to enable PinChangeInterrupt in other pins (previously defined) of the other ports. Am i right?

I just saw this in the webpage of the PinChangeInt Library:
Remember: When you define that a port has no pin changes, you can not attach an interrupt to that port. Attempting to do so will make things a little... weird...
4  Using Arduino / Programming Questions / Re: Is it compatible Attachinterrupt and PinChangeInt library? on: June 25, 2014, 04:04:56 am
Ok, i think i got it.

Then, in summary:
  • If i enable a port which includes an normal external interrupt pin,  but i do not define it by the use of PinChangeInt library, it will be ignored by this library, but it will work as expected if i define it like a normal interrupt
  • if i disable a port which includes a normal external interrupt pin, it will still can be used as a normal interrupt

BTW, could be those pin change interrupts be used to measure high frequency? for example for one of this sensors? It says that it require an interrupt pin.

5  Using Arduino / Programming Questions / Re: Is it compatible Attachinterrupt and PinChangeInt library? on: June 25, 2014, 12:47:18 am
Thanks so much @PaulS!

So, nice! Then, i could dissable all the ports from PinChangeInt except the few i one to use, an at the same time allow to the normal interrupt pins to work as expected in spite they were disabled from PinChangeInt.

Thanks so much!

6  Using Arduino / Programming Questions / [Solved] Is it compatible Attachinterrupt and PinChangeInt library? on: June 24, 2014, 10:54:02 am
I have two question about this tpic:

1) I would like to know if it is compatible the use of normal external interrupts (to pins 2 and 3 in arduino uno board, and few others in arduino mega2560), and  pinchangeint library to create new interrupt pins different thank those?

I mean.. could i have someting like this (in pseudocode):
Add  PinchangeInt library
define PinchangeInt pin X
attacchinterrupt(0, function1, HIGH);
PinChangeInt_interrupt(X, function2, HIGH);

Loop {
 wait for interrupt from both pins, digital 2 and X


2) If they are, what happen if i disable some of the ports in PinChangeInt library what i dont´want to use with this library affecting the normal interrupt pins (2 and 3 in arduino uno board, for example)? Will be then available the use of normal interrupts at that pins?

7  Using Arduino / Sensors / Re: Problem with 4n35 to power camera OV0706 on: June 16, 2014, 07:30:50 am
Thanks @Knut_ny and @Chris (in a PM)  for your comments.

Both of you propose a different solution by a mosfet and by a transistor.
I located this circuit for the use of a transistor:
and here is an example:

and this one for the use of a mosfet as a switch:

I will try both things.

Thanks guys!
8  Using Arduino / Sensors / Re: Problem with 4n35 to power camera OV0706 on: June 15, 2014, 02:39:03 pm
I have a couple of questions about how to follow...

I think i m not able to use a digital pin (as output) to power the camera because the pins in arduino are only able to manage 40 mA... am i right?

If not, i don´t know if i could use a transistor... which one? how?

And finally, should i better use a mosfet? Which one? IRF520,IRF530,IRF 540? Any other? I don´t know which one is the better for this case... use a digital pin to power the mosfet to complete the circuit of powering the camera with 5V from the board.

Thanks folks!

Ok, i know that an IRF510 or IRF520 is enough because they are able to manage 5.6A and 10A, more than enough for the camera and all the sensors i use. But which one (of these or any other) could be triggered with a digital pin of the board?

Or may be by the use of a transistor? may be BC547?
9  Using Arduino / Programming Questions / Re: I need more interrupt pins! How to? on: June 15, 2014, 09:08:11 am
Great! Thanks @Robin2 for this  idea...
10  Using Arduino / Programming Questions / Re: I need more interrupt pins! How to? on: June 15, 2014, 04:35:27 am
Hi @Robin2

If you want to use a button to wake up the Arduino then just dedicate one button for that.
This is exactly what i have on mind

If you want to use the RTC to make the Arduino every hour then the same pin that is used for the button wake-up could be used for that. I can't think of any other reason to use an RTC interrupt. Once the Arduino is awake it can read the time whenever it wishes.
Exactly what i have on mind. Arduino is sleeping, at the selected time it awake the arduino what reads the time, reads the sensors, save the data, made decissions about if to start or not the irrigation, and then go to sleep again until the next time or an awake from the user

I guess my question about the flow meter wasn's as clear as I thought.
No, i am sure you were clear.... the problem is english is not my native language and sometimes my understanding is not complete. Now i see what you mean...

At this stage i don´t know how constant is the flow... But, such as a working hypothesis i will think that yes, it is a constant flow. Then, you are completely right, i don´t need to measure the flow continuosly... may be once per irrigation to ensure the flow is the same, and made the calculations based on time....  Just only one question,how could this affect to the interrupt pins? FOr this kind of cases, could i use a different procedure?

Thanks so much for your patience!

11  Using Arduino / Programming Questions / Re: I need more interrupt pins! How to? on: June 14, 2014, 05:32:40 pm
Thanks @Robin2,

Yes, the anemometer is not working perfectly in an arduino uno by the use of interrupts. However, the new version of the device will include more sensors, such as i already explained, and here is where my problem began.

Buttons certainly don't need interrupts.
Sure, but what about when the arduino is sleeping? The board could be only waked up by inner or external interrupts. So, AFAIK, the button need an interrupt if you do not want to way up the board every few seconds to check it the button is high or low. I repeat that AFAIK... and i am a noob, so, if you know how to do it in other way, i am ready to learn!! So, culd you point to me toward where to read and learn about what you propose?

What is the alarm from the RTC?
Some RTC have the option to produce and square wave out, and few others trigger an interrupt when the time of the RTC reach a selected time, or date or every X minutes or seconds, or hours.... Then, if you program the RTC to produce an interrupt... you could send the board to sleep without take care about the time because the RTC will send the interrupt to a pin of the board what was configured to "listen" the RTC.

What sort of water flow meter have you? How many litres per minute? How accurate do you need to be?
One similar to this:
The limit could be about 3 l/min,and its minimum flow what it is able to measure is 0.1 l/min  However, this is only for testing purposes in this new versios of the device. When i will have everything ready i will change to better sensors for realistic environments.

12  Using Arduino / Sensors / Re: Problem with 4n35 to power camera OV0706 on: June 14, 2014, 05:09:59 pm

This is the key!! The webpage say "Current Draw: 75 mA" and  if you say that the optocoupler only admit 50 mA...
So, i see that i didn´t pay attention to this issue when selecting the optocoupler....

Then, i will remain the optocoupler for to power the different chains of ds18b20 sensors, but to power the camera with a digital pin in output mode...

Thanks so much for your comments!
13  Using Arduino / Sensors / Re: Problem with Camera OV0706 and 4n35 on: June 14, 2014, 02:02:24 pm
Thanks @knut_ny,

Do you mean reducing the value of the resistance conected to pin 1 of the optocoupler?

I know is not correct, but i testing it connecting a wire before the resistance i have (390 Ohms) directly to pin 1 of the optocoupler, and increase a little bit the resulting voltaje, but lower than 2 volts... So, this is without resistance... but for not to burn the inner led i should have, at least, 330 ohms...

14  Using Arduino / Sensors / Re: Problem with Camera OV0706 and 4n35 on: June 14, 2014, 01:10:38 pm
Ok, i discovered that the problem is the optocoupler.
Let me explain the case:

If i connect all the sensors that i have (4 chains of ds18b20 sensors), and i turn on them by the use of the optocoupler, they works correctly.... until to connect the camera! Then, the voltage in all sensors and camera is about 1.4 volts.

If i use the switch for to connect all the sensors to ground without to use the optocoupler, all the sensors receive again 5 volts (4.98 in really)....

So, the problem is the optocoupler... it seems it does not returns enough power when connecting the camera...
May be i should connect in any other way? Or may be use a capacitator?
Any idea about how could i solve this?
15  Using Arduino / Programming Questions / Re: I need more interrupt pins! How to? on: June 14, 2014, 11:23:30 am
Ok, may be i didn´t explained all the required information...
The device will measure only once per hour... So, it will not be tracking the wind continuosly, but only at selected times when it wil be up. I don´t care about to measure wind speed, irradiation, or any other data in between. For that reason, i don´t need to take care about the interrupts from the sensors. In fact, they are "disconnected" because i will power the sensors by an optocoupler only during the o'clock times to take readings.... and then they will be disconnected again. Then, the unique elements what could provide an interrupt will be the buttons (to test the device or to start the irrigation by the user), the alarm from the RTC; or an interrupt from the water level to say that the water deposit is empty.

Then, i do not measure the level of the water... the sensor is near the bottom, and it just only launch an interrupt if the level is low. I need to measure the water flow to know the real consumeof water, because i dont know if theuser will fill the tank completely or not each time... so, what i measure is the water used in irrigation.

About the windspeed, it is an IR emitter-receiver sensor (QRD1114), such as those used in rotary encoders in robots. The anemometer moves a disc withblack/white fields, and the sensors return, high/low values what are captured by the interrup pin. Depending of the number of interrupts uring the measurement period, i could calculate the wind speed.

Sorry @PeterH and @Robin2. I see that i didn´t provideallthenecessary information.. SInce i have my mind on this issue for some time, i have all the ideas on my mind, but i din´t wrote them here. Sorry! And Thanks so much for your patience and interest on help me with this. I really appreciate it.
Pages: [1] 2 3 ... 30