Show Posts
Pages: 1 ... 307 308 [309] 310 311 ... 836
4621  Using Arduino / Project Guidance / Re: Using arduino as a data logger for measuring resistence on: September 16, 2013, 07:40:55 am
I think your options are:
get a meter which can do the capturing for you
get a meter which provides a digital output which you can capture
find a way to use the Arduino's ADC to work with megaOhm/gigaOhm input resistance
create your own resistance sensor working at that very high range

The first two approaches seem simplest. You should be able to solve your problem without involving an Arduino or any programming.
The third approach would probably involve you taking direct control of the ADC conversion process, which would involve dealing with the hardware at a very low level. It may not be feasible anyway.
The fourth approach, which I suspect PaulS may be hinting at, is to either make or buy a highly sensitive current sensor. I've no experience with instrumentation sensors so this may be way off the mark, but I suppose this would probably take the form of a linear current amplifier (I'm envisaging a transistor or op amp) with a series resistance to generate a voltage in the correct range for your ADC to measure. If you aren't familiar with this sort of thing I suspect you will have to face a steep learning curve to get to grips with the electronics involved before you can even start, and given your lack of background in electronic engineering perhaps that's not sensible for you.

There may be more elegant solutions but as far as I can see those are your main options.
4622  Using Arduino / Programming Questions / Re: Reassigning analog pins on: September 15, 2013, 07:24:34 pm
As an intermediate step, if you want to re-route pins without the tin snips and threats that PaulS hinted at, would be to buy a intermediate shield which lets you redirect pins. The Mayhew Labs gobetween shield is one, and I'm sure there are others. I suspect you could get your own shield made for less than the cost of an intermediate shield, so you'd be paying for the convenience, but the option is there if you want it.
4623  Using Arduino / Programming Questions / Re: Rotation algorithm needed on: September 15, 2013, 07:19:21 pm
I only mentioned the matrix approach because once you have got your head around the theory it offers a much cleaner, simpler and more powerful solution to this problem. Since you've gone to all the trouble of constructing an 8x8x8 LED cube this suggests a significant level of interest in 3D displays, and perhaps some ambition to do something more complex than just displaying individual letters at fixed orientations and positions.

It's up to you to decide whether the subject of matrix transformations interests you and whether it's good use of your time. Most of us just play with projects like this for fun, and if matrix maths isn't something you want to do then whether it's a more elegant or more powerful solution becomes irrelevant. At least you know that the option is there if you ever decide to take it any further.

4624  Using Arduino / Programming Questions / Re: Syntax Help - Constants, and Error in Library on: September 15, 2013, 07:05:01 pm
Code:
#ifndef voices_h
#define voices_h

#include "Arduino.h"

class voices
{
  
  //Numbers
  const uint16_t vcOne        = 1;
  PROGMEM char  txtOne[]      = "One";
  const uint16_t vcTwo        = 2;
  PROGMEM char  txtTwo[]      = "Two";
  const uint16_t vcThree      = 3;
  PROGMEM char  txtThree[]    = "Three";
  const uint16_t vcFour       = 4;
  PROGMEM char  txtFour[]     = "Four";
  const uint16_t vcFive       = 5;
  PROGMEM char  txtFive[]     = "Five";
  const uint16_t vcSix        = 6;
  PROGMEM char  txtSix[]      = "Six";
  const uint16_t vcSeven      = 7;
  PROGMEM char  txtSeven[]    = "Seven";
};
#endif


That code looks fundamentally wrong to me. It seems to me that the whole thing could be replaced with an array of const strings, with the array index being the const numbers shown in the code above. Given the implication that you have a lot of these strings, it would make sense to put them in progmem.

Once you've decided how to code your data structures, the way to organise your code would be to define the constant data, variables, types etc in a .cpp file and then put the external declarations for those data, types etc in a .h file which you #include in any source file that needs to reference them.
4625  Using Arduino / Programming Questions / Re: reading from SD card and then logic testing... not working. data type? on: September 15, 2013, 06:59:03 pm
Unless the content of your data file is the output of some other program, you'll find that entering data as ascii text is massively more convenient that entering it as binary data. Unless your space constraints make a factor of eight reduction in data size a critical advantage, I'd suggest you stick with ascii values '0' and '1' in your data file and code the sketch accordingly. This also means you simply process one byte per value instead of having to pull the individual bits out of each byte and process them separately, so it simplifies the whole thing.
4626  Using Arduino / Project Guidance / Re: Metronome - Beats Per Minute? on: September 15, 2013, 06:47:10 pm
I would suggest only re-reading the sensor and recalculating the current interval at the end of each beat, to stop the thing from jittering. Depending on the characteristics of your potentiometer you might also want to include some smoothing so that it averages the period over a few beats rather than changing instantaneously.

The effects are only going to be small compared to the other issues, but if you want to maintain an accurate beat you should replace this:
Code:
previousMillis = currentMillis;
with
Code:
previousMillis += interval;

The distinction is subtle. The first version starts timing the next beat from when it noticed the previous beat ended. The second version starts timing the next beat from when the previous beat should have ended - even if the sketch didn't happen to be checking the time at the precise millisecond that the beat ended. I'd also suggest only performing serial printing once per beat because otherwise this will slow the loop down significantly, so your code won't detect the end of each beat promptly. Combined with the problem mentioned above, this could lead to a significant slip.
4627  Using Arduino / Project Guidance / Re: Trouble With saving Directions on Arduino Uno on: September 15, 2013, 06:35:38 pm
Everywhere you use the word "string" you should use the word "array".

As far as I can see, the bounds of your first loop are wrong since it stops (does not execute the body of the loop) when pathnumber==4. At this point path[3] contains the last movement made and path[4] has not been written to (so it will still contain zero).

In the second loop the bounds of your loop are wrong since it will start from path[4] (which does not contain any useful data) and stop at pathnumber==0 without executing the body of the loop, so the content of path[0] is never processed.

If you replaced this with two for loops as PaulS suggested, it would be more obvious what was going on and the bounds would also be correct.

By the way, your code to handle the different movement values could be made less repetitive by replacing the if/else sequence with a switch statement, and putting the push/pop logic before or after the switch rather than duplicating it for each direction.
4628  Using Arduino / Project Guidance / Re: Controlling 2 DC Motors for a small amusement ride - Need help. on: September 15, 2013, 06:21:11 pm
You probably also want to be able to read the position of the unit on both axes, and to me that implies a rotary encoder.

Given the possibility of commanding abrupt direction changes you need to be aware that motors can exceed their nominal torque rating if powered in reverse while they are moving, and you should consider whether excess speed or excess acceleration or simply the inability to bring the device to a stop when required could introduce safety critical issues. I can already see some failure modes that would concern me if I was liable for this.
4629  Using Arduino / Project Guidance / Re: Talking clock on: September 15, 2013, 06:11:18 pm
Locate the Arduino directory where your sketches are saved. On windows this would typically be under My Documents\Arduino or similar.

Locate the libraries directory under that. Each non-core library that has been installed should be represented by a directory here. The name of the directory is the name of the library. There should be a header file which has the same name as the library with a .h extension under there.

Once you have located the folder associated with the library you're using, you should find a file talkie.h inside it. If you don't then you have not installed the library correctly.
4630  Using Arduino / Project Guidance / Re: data collection and storage rates on: September 15, 2013, 06:03:29 pm
There are plenty of automotive data loggers that support logging of accelerometer data - this is bread and butter for anyone doing race development. My ECU and wideband controller both enable me to log RPM, which is enough to calculate real-world performance. I've got a couple of standalone Racetech data loggers that provide logging of accelerometer data along with other variables and there are dozens of similar products on the market. Racetech includes some loggers that won't break the bank, and then there are companies like G-Tech that sell cheaper devices more suitable to the weekend enthusiast that still return useful data, especially if you're more interested in tracking performance changes rather than getting absolute performance figures. You must know that absolute power/torque are almost meaningless since there are so many different ways to standardise and compensate for operating conditions - I can easily get readings from different sources that vary by 30% or more, and none of them are wrong, they're just different.
4631  Using Arduino / Project Guidance / Re: data collection and storage rates on: September 15, 2013, 05:50:38 pm
On a level road with no wind it's possible to get a useful indication of power. There are various correction factors you will need to apply to the obvious mass-times-speed-time-acceleration formula. You will need to either measure or estimate the typical pitch attitude of the vehicle to compensate for the fact that the accelerometer doesn't remain aligned exactly with the direction of acceleration. If you look at the trig you'll see that the system is not highly sensitive to pitch changes so you need to be too fussy about it - I use several systems that just apply a crude scale factor. You'll need to estimate the components of drag proportional to speed (mainly rolling resistance and transmission losses) and speed squared (mainly aerodynamic drag). You can get the raw data needed for that by a coast-down deceleration run through high and low speed ranges. You can verify your approximations by comparing the actual terminal speed with the calculated terminal speed.

The accelerometer based approach is obviously convenient as it doesn't need any special connections to the vehicle, but if you use a wheel speed sensor you can eliminate integration errors and all the approximations used to estimate the instantaneous speed throughout the run, which gives a more accurate result. If you're up to a DIY accelerometer based solution then fitting a wheel speed sensor instead ought to be simple enough. If all else fails all you need is an engine speed input and knowledge of the vehicles gearing. If you aren't set on a DIY solution, you can buy relatively inexpensive accelerometer based systems that will work as well as anything you're likely to make.
4632  Using Arduino / Programming Questions / Re: Array question on: September 15, 2013, 09:14:16 am
I'm not sure what count line you're referring to, but it's good practice when using arrays to define a constant which holds the length of the array. You would use this whenever you need to refer to the length of the array (for example in the bounds of a for loop) instead of hard-coding the array length throughout your code.
4633  Using Arduino / Project Guidance / Re: can i identify in code (if condition) if runing on mega or uno? on: September 15, 2013, 09:07:51 am
The way to do it would be by a pre-processor conditional compilation of the code relevant to your platform. There are some macros __AVR_ATmega640__, __AVR_ATmega1280__, __AVR_ATmega2560__ etc which would enable you to do that. But it would be better to check for the specific feature/resource of the board that you are trying to use, rather than guess from the board type whether it's available. For example, the number of analog input pins is defined by the macro NUM_ANALOG_INPUTS, the number of digital pins is defined by the macro NUM_DIGITAL_PINS, you can use the macro digitalPinHasPWM(p) to determine whether a given digital pin supports pwm output.
4634  Using Arduino / Project Guidance / Re: Creating a small rice dispenser on: September 15, 2013, 08:55:59 am
Ben Krasnow on YouTube made a dispensing carousel for various types of food ingredients. I recommend it as an interesting video anyway, but perhaps it will give you an inspiration for your problem.
4635  Using Arduino / Programming Questions / Re: Telnet server variables specific to client connected. on: September 15, 2013, 08:51:48 am
What you're trying to do ought to be possible, as long as you ensure the client sends something as soon as it connects and does not wait for a prompt first.

Otherwise, having four long-running client connections and reading and writing to them repeatedly and knowing which one you are dealing with at any given moment is certainly feasible using the existing Ethernet API.
Pages: 1 ... 307 308 [309] 310 311 ... 836