Show Posts
Pages: [1] 2 3 ... 193
1  Using Arduino / Sensors / Re: I bought 5 digital rotary encoders. 1 interrupt. on: July 30, 2014, 10:40:12 pm
 I have a keypad that connects directly to the arduino.

It came with the "starter kit" that I got with my first arduino,   I have seen the same thing on ebay for about $2

2  Using Arduino / Sensors / Re: Measuring angle using gyroscope on: July 30, 2014, 10:37:05 pm
Well it needs to be a global variable,   so you can keep the progressive result of your integration.

But then if it is,  you don't need to return it from the function.     The other part of the program, that wants to use it,   can just refer to the global variable also.      So you don't actually need a return value there,   you could just have the return type of the function as void,   not have a return statement,   and save some time.

I assume that you are also aware that,  because of noise and drift,   this process of adding up the rotation rate to find out the total angle you have turned,    will become highly inaccurate in a matter of seconds,    without some other calculation to correct it.
3  Using Arduino / Sensors / Re: I bought 5 digital rotary encoders. 1 interrupt. on: July 30, 2014, 09:09:43 pm
Thats a good question,  which I was thinking about on your behalf two days ago.

If the "interrupts" were all positive pulses ( for example ),   you could set up a cascade of "or" logic gates,   so that an interrupt from any of your multiple devices  would be combined together into one interrupt to the arduino.

The problem is,   your interrupt event is a change of state from high to low,  on any of the 8 or 10  encoder outputs that you hav e.     It is certainly possible to design a cascade of discrete flip-flops and nand gates and stuff,   which is going to detect a rising or falling edge of any of your 8 or 10 encoder outputs,   and give you one pulse for your arduino interrupt input.    That's how we used to do it,  back in the early 70's.    I've forgotten how to do it now.

The other problem is,  once you get an interrupt,  what then ?   On a mega you could have a digitial input for each of your 8 or 10 signals,   get the interrupt, go check them all, see which one changed.    On a nano,  you might not have enough input pins available.   So you would be back to some kind of shift-register input method anyway.   Given the high processor speed,  it is probably simpler to continously read the shift register rapidly,    and not use interrupts at all.    It also depends on what other tasks you expect the nano to do.

You also have to think about what happens,   if you somehow miss one of the encoder state transitions,  and how you work around or recover from the discrepancy that will introduce.    Does it matter ?

I'd actually go and get a $2 keypad  and enter the numbers that way.



4  Using Arduino / Sensors / Re: Measuring angle using gyroscope on: July 30, 2014, 08:58:37 pm
Code:
float getXGyro() {
  byte* data = readFromDevice(GYRO, 0x1D, 2);
  float gyroRate = (((data[0] << 8) | data[1]) / 14.375) - gyroXOffset; // divide by 14.375 gives degrees per second
  gyroXAngle += gyroRate * dt;
  return gyroXAngle;
}

For this bit of code to be doing anything useful,    gyroXAngle must be a global value in your program.

There is not a lot of point to having it as a global variable AND as a return value from the function.  You are just wasting some of the cpu time.
5  Using Arduino / Sensors / Re: Measuring angle using gyroscope on: July 30, 2014, 08:56:01 pm
If your loop( ) is running quickly,   dt will usually be zero,  the way you are calculating it.

You need to make dt a floating point number so that it can be a fraction of a second.

Or alternative,   calculate the roll rate in degrees per millisecond,   and dt in milliseconds.

6  Using Arduino / Sensors / Re: I bought 5 digital rotary encoders. 1 interrupt. on: July 30, 2014, 04:55:42 am
Well,  if I actually wanted to enter a four digit number to specify the frequency I wanted,   I'd probably use a keypad to do it.

Otherwise,   the shift register.

There are probably other methods.
7  Using Arduino / Sensors / Re: windows shutter Level sensor on: July 30, 2014, 04:45:01 am
Limit switches.
8  Using Arduino / Sensors / Re: DS18B20 doubt on serial number and using Array on: July 30, 2014, 04:35:26 am
Suppose you have a large room filled with hundreds of people,   and you want to find out their social security numbers.

You could ask,  is person 00000000000 here ?   Is person 00000000001 here ?       up to person 9999999999 here ?

It would take years.

What it actually does,  is more like this:

Does anyone have a social security number starting with 1 ?    ten people put there hand up.
Does anyone have a social security number starting with 11 ?    three people put their hand up
Does anyone have a social security number stating with 111 ?   two people put their hand up.
Does anyone have a social security number starting with 1111 ?    Nobody
How about 1112 ?   One person .     Got one response.    Then ask that person what their whole number is,   and write it down.
How about 1113 ?   One person.   write it down.
You have now collected both of the two people who responded to 111.   You can move onto the next subset range
112 ?   Nobody
114 ?   One person.   Get their number.
You now have all the 3 people starting with 11.
12 ?   Four people
121 ?  Nobody
122 ?  Nobody
123 ?  One person.  ask them for their number
124 ?   and so on


keep doing this until you get all the numbers.    Thats how it works.
9  Using Arduino / Sensors / Re: DS18B20 doubt on serial number and using Array on: July 30, 2014, 04:29:10 am
the way it works,   is that it doesn't have to actually try 2 to the power of 64 addresses.

it asks for subsets of those.   If it gets more than one response,    then it divides the subset into smaller subsets,  and asks again,   until it gets a response from exactly one device.

You can read the description of that yourself.

This reduces the number of addresses it has to try,    from trillions  to only tens of thousands.
10  Using Arduino / Sensors / Re: Does the ATMEGA328P have a multiplying DAC or just an ordinary DAC? on: July 30, 2014, 04:25:20 am
Your outcome seems implausible.    Either you have done something wrong with your code,    or your photodiode is outputting voltages which have specific steps,   which seems unlikely.

Can you post the code you are using which gives this apparent outcome ?
11  Using Arduino / Sensors / Re: DS18B20 doubt on serial number and using Array on: July 30, 2014, 04:21:42 am
Quote
What about the missing question on MSB and LSB.?

See reply #1.    I thought you had figured that one out by now.    That is a normal technique  for  any communication of numbers bigger than one byte.

12  Using Arduino / Sensors / Re: DS18B20 doubt on serial number and using Array on: July 30, 2014, 04:19:06 am
Quote
I assume ds.search it's in charge or reading the embedded logical serial number like you said.

No.  It doesn't read any embedded logical serial number at all.

ds.search( ) has to try all possible addresses.   It starts sending out messages with different addresses  one after the other,   until a device responds.       ds.search( ) never gets an address from a device.   It generates the addresses itself -  millions of them,    and it tries them all,   until it gets a response from a device  which happens to respond to the address which it tried.

13  Using Arduino / Sensors / Re: DS18B20 doubt on serial number and using Array on: July 30, 2014, 04:15:38 am
The OneWire  class shows you how to implement a one-wire  "master" device.     I don't know how you would go about implementing a one-wire "slave device".

With enough experiments,   you could probably "reverse engineer"  the logic required.   It is only moderate-grade rocket science.

I would suggest reading all of the documents which are available this protocol.   I looked at them last year,    there is a lot of information there.
14  Using Arduino / Sensors / Re: Multiple DS18B20 on a 10meter long Cat5, not discoverable.... HELP!!!! on: July 30, 2014, 04:12:41 am
Well if you can see your 1 Hz square wave pulses through the cable,    that's better than nothing.   At least it shows the conductors don't seem to be broken.

And you are getting good voltage, which is also good.

And your arduino is capable of pulling the wire down close to zero volts,     which would tend to suggest that your pull-up resistor isn't too small.

The point is,  due to the capacitance and inductance of the cable,   that square wave gets distorted   and has sloping rises and falls and overshoots as the frequency increases.   This happens with any kind of transmission through any kind of cable,   and it limits both the frequency and the length of cables you can use.   

For example,  normal ethernet won't work for more than about 500 metres,  or whatever it is.    On the other hand,  SPI might not work if the wires are longer than 20 centimetres.

But we know that many people have succeeded at getting  DS18B20's  to work at distance over 10 metres,   and up to at least 30 metres.    So you should be able to,  also.      I don't know why you can't.     I am pretty close to out of ideas..... smiley-confuse



15  Using Arduino / Sensors / Re: DS18B20 doubt on serial number and using Array on: July 30, 2014, 04:04:07 am
Has that covered all your questions ?
Pages: [1] 2 3 ... 193