text:
Thermistor value correct on Uno backwards on Nano
EDIT: upon further investigation: I found out that if I wired it Thermistor > resistor > GND values go one direction. If I wired it Thermistor > Resistor > 5v, it goes the other direction. So my new question: Which way is correct? One sketch assumes it works one way, and one the other.
I have some Thermistors from here. I have an Arduino Nano and an Arduino Uno, both set up identically with pictures of the wiring below. On the sketch below, when I heat up the thermistor the value increases on the Uno and decreases on the Nano.
// which analog pin to connect
#define THERMISTORPIN A0
// resistance at 25 degrees C
#define THERMISTORNOMINAL 10000
// temp. for nominal resistance (almost always 25 C)
#define TEMPERATURENOMINAL 25
// how many samples to take and average, more takes longer
// but is more 'smooth'
#define NUMSAMPLES 5
// The beta coefficient of the thermistor (usually 3000-4000)
#define BCOEFFICIENT 3950
// the value of the 'other' resistor
#define SERIESRESISTOR 9800

int samples[NUMSAMPLES];

void setup(void) {
  Serial.begin(9600);
}

void loop(void) {
  uint8_t i;
  float average;

  // take N samples in a row, with a slight delay
  for (i=0; i< NUMSAMPLES; i++) {
       samples[i] = analogRead(THERMISTORPIN);
   delay(10);
  }

  // average all the samples out
  average = 0;
  for (i=0; i< NUMSAMPLES; i++) {
     average += samples[i];
  }
  average /= NUMSAMPLES;

  Serial.print("Average analog reading ");
  Serial.println(average);

  // convert the value to resistance
  average = 1023 / average - 1;
  average = SERIESRESISTOR / average;
  Serial.print("Thermistor resistance ");
  Serial.println(average);

  float steinhart;
  steinhart = average / THERMISTORNOMINAL;     // (R/Ro)
  steinhart = log(steinhart);                  // ln(R/Ro)
  steinhart /= BCOEFFICIENT;                   // 1/B * ln(R/Ro)
  steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
  steinhart = 1.0 / steinhart;                 // Invert
  steinhart -= 273.15;                         // convert to C

  Serial.print("Temperature ");
  Serial.print(steinhart);
  Serial.println(" *C");
  Serial.println();

  delay(1000);
}

On the sketch below, the Uno is backwards and the Nano is correct. I'm sure there's something simple I'm missing, but I sure can't find it. Any suggestions?
#include <math.h>

double Thermistor(int RawADC) {
 double Temp;
 Temp = log(10000.0*((1024.0/RawADC-1)));
 Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
 Temp = Temp - 273.15;
 Temp = (Temp * 9.0)/ 5.0 + 32.0;
 return Temp;
}

void setup() {
 Serial.begin(9600);
}

void loop() {
  int val;
  double temp;
  val=analogRead(7);
  temp=Thermistor(val);
  Serial.print("Temperature = ");
  Serial.print(temp);
  Serial.println(" F");
  delay(1000);
}

Nano Wiring
Uno Wiring

There is no "correct" way. The thermistor and the resistor combine to make a voltage divider. Whether the thermistor is connected to +5V (AKA R1) or to GND (AKA R2) determines the formula to use to calculate the resistance.
The general form is:
          R2
Vout = ------- x Vin
       R1 + R2

To solve for R2 (thermistor connected to GND) you re-arrange to:
                 1
R2 = R1 x --------------
          (Vin/Vout) - 1

To solve for R1 (thermistor connected to +5V) it's:
     R2 x Vin
R1 = -------- - R2
       Vout

Vin, of course, is 5V, and Vout is a voltage you calculate from the analog reading on the Arduino.
Once you have the resistance you can then calculate the temperature. That part doesn't change regardless of the orientation of the thermistor.


text:
Return value of 0 if value is less than zero
Background: I am using an analog pressure sensor with a range from 0-100PSI returning voltage values .44v to 4.44v. It's open air (or 0 PSI) voltage on the signal pin is .47 volts. I have a function that subtracts that .47v (to make zero) and then multiplies it by 25 (25 PSI per volt). Due to signal noise or other factors, sometimes my function returns a negative number, which wreaks havoc on my math. I would like to return a value of 0 when my offset math returns a negative number, but I'm having a problem with it.
The code that I wrote that doesn't work:
double EngineOilPressure() {
    //insert oil pressure code here
    int reading = analogRead(sensorPin3);
    float voltage = reading * 5.0;
    voltage /=1024.0;

    Serial.print(voltage); Serial.println(" volts");

    if (voltage-.47 < 0)
    {
        float voltadj = 0;
    }
    else
    {
        float voltadj = (voltage-.47);
    }

    float pressureP = voltadj * 25;
    return PSIToPascal(pressureP);
}

The error that I get is
dynamic_engine.pde: In function 'double EngineOilPressure()':
dynamic_engine.pde:41:23: error: 'voltadj' was not declared in this scope
Error compiling.

The code that works but sometimes returns a very wrong value:
double EngineOilPressure() {
    int reading = analogRead(sensorPin3);
    float voltage = reading * 5.0;
    voltage /=1024.0;

    Serial.print(voltage); Serial.println(" volts");

    float pressureP = (voltage - .47) * 25;
    return PSIToPascal(pressureP);
}

The scope of each of the two different and unrelated voltadj variables that your code (as below) declares is limited to within its enclosing set of braces.
if (voltage-.47 < 0)
{
    float voltadj = 0;
}
else
{
    float voltadj = (voltage-.47);
}

Instead perhaps say
float voltadj = voltage-.47;
if (voltadj < 0) voltadj = 0;

or perhaps
float voltadj = voltage < .47? 0 : voltage-.47;

or
float voltadj = constrain(voltage-0.47, 0.0, 5.0);

or
float voltadj = max(0.0, voltage-0.47);

Also see max() and constrain() reference pages at arduino.cc.

Another method, though one that is quite cryptic to understand, would be:
float pressureP = voltage > 0.47 ? (voltage - 0.47) * 25 : 0;

That is known (by me at least) as an inline conditional.  The ? acts as an if operator, and the : as an else.  Basically it's saying:
Voltage is greater than 0.47
Is that true?
    then subtract 0.47 and multiply by 25 and assign it
otherwise:
    assign 0

The format is simply:
value = {condition} ? {true value or expression} : {false value or expression};

If can be quite useful when you want to conditionally calculate or assign something.  @jwpat7 makes mention of a max() function above.  That max() function can itself be written with this inline conditional format:
maxval = a > b ? a : b;

Or: If a is greater than b then assign a otherwise assign b.

This is the one I ended up using, thank you! I love the simplicity.

The Arduino way is to use constrain
float pressureP = constrain ((voltage - 0.47) * 25 , 0 [The Maximum your code can handle]);

This will return the value ((voltage - 0.47) * 25) but never less than 0 and never more than The maximum you provide.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Opto Isolator question
I'm building a CANBUS network based on an arduino to go into an offroad racing truck. The vehicle has two separate battery systems, and I would like to monitor the voltage while still electrically isolating them from the arduino itself. For the voltage monitoring itself, I assume I can use a simple voltage divider into an Analog pin. To electrically isolate the arduino, would an Opto Isolator work? I found this one: https://www.sparkfun.com/products/9118 But it appears that it's designed for low voltage to control high voltage, as opposed to the other way around.

An optoisolator is good for digital signals, but won't transfer an analog signal accurately.
Instead, you could put ADCs on the different circuits and optoisolate their communication with a master Arduino.

Instead of an ADC, I'd use another microcontroller with an integrated ADC (even a snall Attiny85, just 8 pins and three analog pins) powered by the battery it has to sense. Every x seconds (or milliseconds, but going really fast is useless I think) it wakes up, makes a conversion, sends it on the serial interface and sleeps again. This way you will just need one optoisolator (on the serial wire going from the attiny to the receiving circuit). using an external ADC will require three optoisolators for SPI or a strange configuration for I2C (because its wires are bidirectional)

The voltage sensing side was going to have it's own microcontroller anyway, so I'll probably do that!

If you are using separate microcontrollers on separate battery systems, maybe a wireless solution would be good.

1) using current sensors based on Hall effect: https://www.sparkfun.com/products/8882. Their sensing circuit/leads and analog parts are electrically isolated.
The drawbacks are: to calculate the voltage, need to wire some load resistor with known value to batteries, but you can switch on the load circuit by relay during measurement; susceptible to magnetic field, some shielding might be needed.
2) to use isolation amplifiers: please see http://www.analog.com/en/products/amplifiers/isolation-amplifiers.html

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Digital Vs. Analog Sensor
Background: I'm using an Atmega1284P to add sensors to an off road racing truck onto a CANBUS network. The standard automotive sensors are thermistors, but the Dallas 1 wire temp sensors (DS18B20) with an integrated ADC caught my eye. They don't, however, come in a package that would work for my purposes so I would have to build one. I haven't been able to find one waterproofed in an NPT fitting with only a 1" probe length.
My question: how much more accurate would the 1 wire be over a thermistor?
How much of a difference would it make for processor efficiency to not have to do the math involved with thermistors and just read the value from the 1 wire? I don't mind building them, I just want to make sure they're worth it first.

Without addressing the issue about which would be "best" or more accurate, there is quite a bit of CPU work involved with "talking to" the 1-Wire devices. Probably a lot more than a couple of calculations with a thermistor. As for which is more accurate, you would need to look at the DS18B20 datasheet, and compare it to the datasheet for a particular thermistor, to be able to say about that for sure. How about a thermocouple instead?

Judging by a few datasheets I found, the DS18B20 is accurate to ± 0.5 °C, and one of my thermistors is ± 1 °C. So yes, the DS18B20 is more accurate than this thermistor, but is 0.5 °C important in this particular application?

Another usefull feature is the fact they come factory calibrated, according to datasheet.

@NickGammon half a degree doesn't matter, no. I don't think I'll end up being able to use the DS18B20 though, as a few of my sensors need to be able to go up to 300F. With thermocouples, I would need an additional IC per sensor such as the MAX31885, correct?

I haven't tried using thermocouples apart from the one on my multimeter. There are various types, and I gather that they output low voltages which may need amplification and interpretation.

To make an informed decision you first need to understand a few basic concepts and some pros and cons of each system.
Firstly there are the concepts of precision and accuracy. These are two very different properties and each is important in their own way. On the face of it they may sound the same, but they aren't.
Precision
This is how close to the real value your measurements are. This is the "±"  value that datasheets list. It's how close a match to the actual temperature the measured temperature is.  So a ±0.5° measurement could be anywhere within half a degree of the actual temperature.
Accuracy
This can also be considered as the resolution of the measurement. It is how fine a difference in temperatures the device is able to measure. For instance you may be able to detect 0.0125° differences.  This is mostly defined by the resolution of the ADC in the device.
And now the pros and cons:
Digital
Pros
These devices can be factory calibrated for a more precise reading. The accuracy is usually pretty good too, but is fixed by the design of the device. Communication is generally reliable and wire length doesn't generally affect the values reported.
Cons
Communication protocols can have some large overheads limiting the number of samples you can take per second (not just on one sensor but across the whole array of sensors). Excess EMI noise (especially from engines) can corrupt the communication signals over long connections unless extra care is taken (such as implementing a balanced line communication medium).
Analog
Pros
Very simple to connect up and samples can be read very rapidly. Accuracy is determined by the ADC you choose to use.
Cons
Wire length can have a detrimental affect on the values read unless special wiring and sensor schemes are used to cancel out the resistance of the wires. Noise induced into the wires is very hard to detect or cancel out and can give spurious results. Requires more complex mathematics to calculate a resistance.
Summary
So in short: Digital can give you more reliable communication of your sampled values over longer distances but at the cost of reduced sampling speeds.

I'd say accuracy is about how close a reading is to the actual/true value, while precision is related to differences when repeatedly getting a reading for the same actual value. And resolution would be a separate thing altogether, I'd say, indeed kind of describing how many digits are produced.

I'd call what you term precision "variance". Anyway, regardless of what one part of the world calls something compared to another (which we can argue over all day and get nowhere) it's the concepts that are important not the names.

I fully agree with Majenko except for the cons for analog.
Basically it is not easy to get a (very) accurate ADC reading with an arduino.
The main problem is the reference voltage that fluctuates.
This is the main reason why I prefer digital to analog when it needs to be "correct"

Since the ADC inside of something like the DS still relies on the 5V from the Arduino, would it not drift just as much as the Built in ADC?

There are tricks around like doing a comparative read, measure at a lower voltage, capacitors, giving the ds it's own power suply ...

I don't know this particular DS but the data sheet should be able to tell you.

Internally though, there must be an analog reference somewhere, right? You can get precision analog voltage references. I looked into some here.

Nick; I know it can  be done. Basically the tricks I mentioned above can be used with arduino as with any other device. My point is that it is not so easy to get very accurate analog readings. There is needed more than the Arduino analog read example. As such "no matter how accurate the Analog signal is; you still have to account for the accuracy of the ADC"


text:
Arduino audio output circuit
I am looking to build my own arduino-based board that, when triggered, will play a file (line out, not amped to a speaker). Most of the audio shields I see are more complicated than I need, so what I'm wondering is what is the barebones circuit I would need for audio output? I've got the atmega and SDcard side fine, I'm just not sure what IC's are involved in audio output. WAV's are fine so I don't have to deal with mp3 decoding.
PS feel free to move this to electronics instead of arduino, I'm not sure where it belonged since it's built into an arduino board but is more the electronic circuitry.

If you don't care much about quality then all you need is two capacitors and a resistor. Use PWM to create the audio (there is a timerpcm pr something library that will do it). The resistor and pne capacitor form a low pass filter for the PWM, and the other capacitor removes the dc offset.
----/\/\/\----+----||------
              |
             ---
             ---
              |
              _
              -

Because at the time i didn't have one to hand and the question wasn't worth spending the time making one. Also we didn't have the schematic editor enabled back then.

authors: علیرضا قاضیان


text:
MPPT using preassembled 'adjustable' buck/boost IC
This is more of a thought experiment, as I don't know if I'll have the time to work on it.
Items:

Arduino
Homebrew MPPT controller from Instructables
LM2596 Adjustable Buck Regulator

Idea:
Looking at the Instructable, that seems like a fairly interesting and robust circuit, originally developed by one Tim Nolan whose website no longer seems to exist.
I'm somewhat lazy/fearful of messing things up when building from scratch, so I like to get preassembled modules and tinker instead. So, my thought is simple (ish). Looking at the LM2596 module, the output voltage is determined by the setting of the multiturn pot. I'd like to replace that pot with, say, a PWM controlled voltage from an Arduino, which I can then adjust using Tim Nolan's code to achieve MPPT.
So to be very specific, the question is: can I safely remove that pot and use a PWM'd voltage in its place, in order to control the output for MPPT?

No.
The switching frequency of the LM2596 is 150kHz, but the sampling frequency of the Arduino is only 10kHz (on a good day).  You won't be able to adjust the PWM quickly enough to fine-tune the LM2596 output voltage.  The LM2596 uses the 1.23V feedback voltage to change what it's doing.  But the feedback voltage will only change as fast as the Arduino can change the PWM feeding it (and that the RC smoother will allow).
It will be like pushing a shopping cart backwards, blindfolded.  By the time you feel the directional change in the cart, it will have steered off course by quite a bit.  Then you have to compensate wildly to bring it back on course.
The same would probably happen here: the LM2596 would begin adjusting the output voltage to make the feedback voltage come back towards 1.23V.  But the Arduino doesn't respond in time.  The Arduino has to do an ADC conversion, do some calculations, change the PWM, which eventually changes the RC output voltage, which is the feedback voltage.  So the LM2596 changes some more... and even more.  Eventually the feedback voltage does change, but by this time the output voltage has changed significantly.
Another way to look at is that the LM2596 is like another "processor", trying to optimize its own function, output voltage instead of MPPT.  It's running much faster than the Arduino, so there's no way the Arduino can trick the LM2596 into doing what it really wants, MPPT.

This makes sense, I wasn't thinking about the switching vs. sampling frequency. Knew I was missing something. The second answer here seems plausible - using a digital pot instead to replace the trimpot, or feeding it a fixed PWM voltage separately from the output. I might try that and see, but based on your answer direct PWM control is clearly out of the question.

Yes, as Gerben suggested, a digital pot would be ok, because it has the same (nearly) instantaneous response as a passive resistor.  This decouples the Arduino from the response cycle, which is good.  It will be free to measure current and voltage at its leisure (you still have to measure both).  Of course, the software will be different, as you would be changing the digital pot value instead of the PWM frequency/duty cycle.

@Boloar, here is a relevant discussion at EEVBlog.  Reply #6 mentions using PWM+filter to offset the feedback resistor voltage.  This also allows an instantaneous response to be seen by the regulator.  Just make sure the PWM freq is high enough and the filter RC is slow enough that the regulator doesn't see a ripple it needs to correct.  Oscillation, anyone?  :)

The pot is actually part of the feedback mechanism, so you can just feed it a fixed voltage (based on PWM duty cycle). See the second diagram on page 9 of the datasheet
You could however replace it with a digital pot (not necessarily 10k).

Thanks, I don't know why I didn't think of a digital pot. I'll look into both options, :-)


text:
How much numerical precision can the ESP8266 achieve?
Background: I am trying to port this solar tracker code by Gabriel Miller to run on the ESP8266. Now I'm not a particularly great coder, but I'd like to give it an honest try.
As of recently, the ESP8266 can be natively programmed using the Arduino IDE and code base. Which is pretty convenient.
SO. The solar tracker code written by Gabriel works on the Arduino Uno and the Arduino Mega. The Mega version of the code has a high-precision calculation library called 'BigNumber' to calculate the Sun's position in the sky to a pretty precise degree. My question is:
From what I've read, the ESP8266 is supposed to be a 32-bit microprocessor, so (I assume?) it should be able to handle high-precision numbers without using the BigNumber library; so, how do I check what's the highest numerical precision that the ESP8266 can support? That way I could theoretically just copy the equations over to the ported program rather than having to rewrite the BigNumber library.

If anyone with a better grasp of C code and Arduino and such wants to give it a shot, be my guest. Give a shoutout to the code author Gabriel Miller for creating a pretty awesome bit of Arduino code.

I ported the BigNumber library to the Arduino in 2012. The BigNumber library is based almost entirely on the GNU "bc" library. What it does is store numbers with arbitrary precision (ie. as large as you like, and with as many decimal places as you like).
For example, on the Uno you can calculate 3160 like this:
3^160 = 21847450052839212624230656502990235142567050104912751880812823948662932355201

Or, the square root of 2 to 100 decimal places:
sqrt(2) = 1.4142135623730950488016887242096980785696718753769480731766797379907324784621070388503875343276415727

It's up to you how many decimal places you want. However the trade-off is RAM and speed. The more precision, the more RAM and the slower it is.
A normal precision float (like on the Uno/Mega) has around 7 decimal digits of precision. A double float has around 16 decimal digits of precision. See Wikipedia - Floating point.
If the ESP8266 has a C++ compiler then you could probably convert the BigNumber library without too many issues. However if it supports double-precision floats you may not need to.

How do I check what's the highest numerical precision that the ESP8266 can support?

You may want to ask on the ESP8266 Community Forum - they may be able to give you a more helpful answer.

Reference

Arbitrary precision (big number) library port for Arduino
Source on Github

Hey, Nick, thanks for your reply! I believe it is a C++ compiler since it uses the Arduino code base, but I don't know the C language well enough to effectively port the library on my own. I tried including the BigNumber library in an empty arduino sketch and compiling and it put out about 8 errors in a single file “numbers.c” saying "undefined reference to ‘exit'" and “undefined reference to ‘ctype_ptr’”. That's all of the errors. I'm not sure how to clear that up.

I've posted in the ESP8266 forums. Waiting for a reply.

I asked at the ESP8266 forums and somebody got it working. All good! But, according to the creator of a solar tracker code, it might not really be necessary if the ESP8266 compiler is built to handle double-precision numbers. At any rate: Success!

There's not really any difference in numerical precision.  What you do get with 32-bit though is faster operations on larger data types.
For instance, to add two 32-bit numbers together (uint32_t) would take many operations on an 8-bit CPY, whereas on a 32-bit CPU it would just take a couple (only one to do the actual addition - a couple to load/save the values to memory).
One key difference, though, is that (to save space) the AVR system has double precision float values turned off and aliased to single precision float values.  This is purely a software feature and has nothing really to do with the hardware.  On 32-bit systems that is normally not done, so you can use double instead of float to increase precision.
However: While double is more accurate than float, it is still not precise.  All floating point values, regardless of precision, are only ever an approximation.  For that reason it is often preferred to use integer mathematics, and that is where libraries like BigNumber come in handy.  They allow you to (as the name suggests) work with much bigger numbers, which is good when dealing with integers when you want a high precision.
For instance, you could measure distance in km.  Say something is 18.329846283746km away.  You could store that as a single precision floating point value and it would end up as 18.329845428467.  As a double precision it would end up as 18.3298462837, which is closer, but still not right.
So you could represent it as meters instead of km.  So your 18.329846283746km would be 18329.846283746m.
How about if you represented it as mm instead?  18329846.283746mm
Say, why don't we go smaller?  Micrometers? 18329846283.746µm
I don't like that decimal point still.  What's smaller than µm? nanometers of course!  That would be 18,329,846,283,746nm.
Oh look, we have an integer value.  However that integer value is too big to fit in a 32-bit number even, which has a maximum of 4,294,967,295.  You could try using a 64-bit number (uint64_t) if the compiler you have supports it, which on both 8-bit and 32-bit systems would need multiple operations to work with (though less on the 32-bit), or you could use a library like BigNumber to deal with it all for you.
By using that method you start out by stating "I want to work in this fixed resolution and I want 100% precision within that resolution", rather than saying "I want to work with these values and I hope you'll get it vaguely right", which is far from ideal.
Also working with integer values is generally considerably faster than working with floating point values unless the CPU has a floating point unit available to do the heavy work for you.
So the difference between an 8-bit and a 32-bit system has nothing to do with the precision that is available to you, but everything to do with how fast operations at different precisions take to perform.

Clearly my learning material was lacking. This makes sense, I'd never thought about it like this. I generically assumed more bits = more precision which I guess is technically true but clearly not as simple as I thought. Thanks.


text:
Using arduino IDE with USBasp
I'm trying to upload a Blink example from Arduino IDE to an atmega8a via USBasp. I have edited the boards.txt file with the specifications of the atmega8a, and I am using the "Upload with programmer" option.
AVRdude gives no errors, only a warning that my usbasp firmware needs an update. I assume the code is uploaded, but it does not execute. My fuse settings are hfuse - 0xc0, lfuse - 0x9f, but i have tried different ones to no avail.

Are the libraries you're using compatible with the 8a, and are you compiling for the 8a? You can't just upload Arduino code to an arbitrary AVR without making sure the toolchain supports it first.

Since Arduino doesn't support atmega8a by default, it would help if you told us what board that is in the question, then.

Sorry, couldn't answer earlier, but  I still hope for a reply. Currently, I've set it up in Arduino IDE 1.6.5 using board Arduino NG with atmega8 selected as processor. I already spent quite a lot of time playing with the board setting in boards.txt, but there could have been something I've missed.


text:
LIght bulb to light up
I'd like to write a JavaScript function that lights up an led light for X milliseconds depending on the response from the JavaScript function.
function HowManySeconds() {
   setTimeout(HowManySeconds,5000)
   return 1000
}

The JavaScript function will come from a website, so I suppose I would need an Internet enabled device that connects to my router and can 'browse' to my website.
Q: What do I need to buy? A tessel? An Espruino?

This is an Arduino forum.

I'm a newbie, so I'm not sure where to start. I don't want to invest a lot of time and money on something only to find out I could have done it easier and cheaper by buying something else or newer.

Just to clarify: You want a gadget (eg. an Arduino) connected to an Ethernet cable, which queries your website from time to time, and depending on what that website returns, turns on a light (ie. activates an output) for a few milliseconds. Is that it?

Yes. I'm trying to make the scenario as simple as possible. But I'm a web developer, so I can write the JavaScript. But I need a gadget that when plugged in, will automatically interrogate my web page and light up for the number of milliseconds that is returned. I can have the JavaScript running in an infinite loop so that it's constantly polling.

You could try the intel galileo or the intel edison with arduino shield. They can be programmed with a variant of the arduino ide, but it is possible to call also programs from the native linux os. Or you could have a look at the esp826.
At least on the edison it is possible to run node.js, while the esp supports lua.


text:
Heads Up Display Helmet With arduino
I want to make a HUD Helmet similar to the one shown in Ironman movies. Please suggest me some links and parts needed for this type of project

Someone mentioned below and I think you should think about your goal (a helmet display) vs. your approach (an Ironman-styled helmet display). It is quite easy to do a helmet mounted display - VR being one. it is another story to an Ironman styled helmet display. If the latter is important to you, you may need to wait sometime.

There is a fairly inexpensive solution, but it's not Arduino based.
All you need is:

the Google Cardboard sdk
a fairly modern and powerful Android phone (I have a OnePlusOne and it works well with Cardboard apps) - assuming you already own something similar, this is where the big saving happens :-)
a compatible head unit: there are many available on ebay (on some you might have to drill a hole where the camera of the phone is located.) price got from about $5 to $25
some high level programming skills to write your augmented reality application, but there's no way around it :-) - you might even find some demo on the net.

Here the basic of the solution I'm proposing is to take the video stream from the front camera on the phone, use the CardBoard API to create a view for each eye (yes, you will loose stereoscopy, since each eye will see the same image from the camera) and overlay it with whatever info you would like to show. The simpler case could be a compass, where you show N-W-S-E at the top of the field of view. Or you could even add a map, like in a FPS :-)
The part where the arduino might come useful is if you want to create some (bluetooth, for example) sensor and/or controller (using the usb port from the phone requires both a phone with HW that supports host mode and a rooted device).

You will need Electroluminescent Transparent display, something like this display from Beneq
But these displays are segmented displays...The problem with these displays  is these displays are very expensive :(
other problem is Focusing the display, You need to keep the display at your Focal distance..
Good thing is : You can use "CUSTOM ARDUINO" board to control this display, "IF" size is consideration :)
Happy Learning..

Luckily the concept of an Ironman helmet has more options then one would think and can be broken down as if any form of helmet. First theres the question of dimensions and proportion - this has more options than I realized since the Ironman helmet has undergone many transformations over more than 50 years both in print and film. An image search of "Ironman mask" and "Ironman comic" shows that there are a lot of options to choose from. Additionally I haven't found a consensus to exactly how Ironman was able to see outside the helmet which leaves your options open as well.
The "Ironman Mask" has what some could argue are two covered openings for the user to look through. Call them windows, eye holes - what ever - but they are openings to allow the user a direct field of vision through the helmet. If this is the case you are asking for a system that projects an overlay of some type into the users natural line of sight. Others could argue that these "eyes" on the outside of the mask are just for looks and that the users vision is completely enclosed in the helmet and that their entire view of the outside world is somehow projected into their view within the helmet.
If we're speaking of the first case, an Arduino can be used for a simple head mounted display (there are multiple examples if you Google it - include terms "glass", "hmd", and "hud") but Uno and other atmel based Arduinos are limited to simple 8 bit animations and text, nothing truly impressive or emersive. You will also have the issue of image correction in cases where your trying to create a large overlay - the viewable image will warp and fade since not projected onto surface strait on. Lenses can be used to correct but this is costly and not realistic for most diy/makers which only leaves software based solutions which Uno cannot handle running. It is possible however with other boards like the pi zero which is comparable in size and price and has enough power for higher resolution graphics and image correction. Note this approach will still require a single lens for focusing the projected image, but these are basic and cheap lenses as opposed to prisms or multi-lens solutions.
The second case would functionally be more like a VR headset and could be a challenge with some designs of Ironman helmets due to limited space within the helmet. If willing to stretch the proportion of the helmet a generic low definition version could be created using cheap lenses and at least two unos. it will require at least one FPV camera module and two display modules as well as whatever sensors you would be using. this would be more in line with Igor Stoppa's answer.

You can't.  You can't even simulate it or even begin to approach that style of display.
Try it.  Print something out then hold it in front of your face the distance the visor is away from you.  Now try and focus on it.  You can't.  The human eyes are unable to focus that closely.
You would need to focus the vision through lenses (which is what VR headsets do) or directly project through prisms and lenses into the eye (which is what Google Glass does) in order for you to be able to see the images you generate.
You could do it if you required the user to wear special glasses to focus their vision, however they then wouldn't be able to focus on anything else much and would keep walking into things and tripping over their own feet.  The rest of the world would just be a complete blur.
The whole depiction of those kind of HUD displays are impractical.  In military HUD systems the image is either fed via a single eyepiece (and it takes lots of practice and brain training to get the brain to superimpose the two images), or it's projected on to the cockpit window.  The only way it could be done as they depict it would be to directly project the images into both eyes (to create a 3D effect) superimposing it over the natural light entering the eyes.  That would then of course mean that it would be invisible to anyone except the user, so still wouldn't be quite the same.

See my answer. Nowadays even VR and AR are getting quite cheap :-)

@IgorStoppa Do you know what the Iron man HUD is like? It's not a vr headset. There is no headset. It's nothing like Google cardboard or occulus rift or anything like that. A vr headset is not what the op is asking for.

Did you read my answer before writing the comment above? I described an augmented reality contraption, not a VR headset. Which is precisely what can be done, as I described, with Cardboard, since there is a camera on the other side of the phone. The fact that in the movie the HUD is allegedly done with a projector is irrelevant, for the purpose of creating an augmented reality experience. At least I have proposed a plausible solution.

What you are describing is a VR headset that happens to have a camera. That's not AR, for that you need something like Glass . It's a completely different concept. If the OP wanted a VR headset, with or withoutvavcanera, he wouldn't be asking for an iron man hud.

Nope, you are just yet another victim of marketing campaigns. See the definition: https://en.wikipedia.org/wiki/Augmented_reality. It's exactly what I described. The key point is that you show to the user a live stream of a camera with a feed from (roughly) the same perspective as the real eyes. And then overlay it with additional info. So a VR device is perfectly ok, as long as it shows as base image a live feed from the user's perspective, rather than a fully synthesized world.

It still, whatever your chosen definition, isn't even close to the Iron man HUD the OP is asking about.

Matter of opinion. Btw, any sane design of a weaponized AR a-la-IronMan would do just this: use a slab of metal with a camera on the outer side and a display/projector on the inner side, rather than ALON for see-through, like HoloLens. The ALON can be used to protect the camera. So I think this is really close to what the OP was asking. But I'll let him decide.

You can't. that's a little presumptive.

@dannyf Science Fiction is called that for a reason. With current technology it's impossible to project onto glass an inch away from an eyeball and be able to focus on it. So you can't is not presumptive, it's correct.

@Majenko This answer is categorically wrong. I'm sorry to sound harsh, but your last comment was in Jul of '17 at which point many examples where available to prove the concept is possible if you were to search for it. You should remove this or change it

@JSON I'd love to see one. I still say what the op asks for is impossible.

@Majenko - https://hackaday.com/2018/03/25/iron-man-mask-with-a-hud/ . Not the best, but at least proves it's possible

A poor man's Google glass. Have you seen the iron man HUD? It's nothing like that. Completely different. And impossible. Still, not a bad attempt at making something light up within the field of vision.

@Majenko I think your taking the OP's question too literally although a true reproduction would definitely be out of the question to an amateur. Since people who develop flying weapons systems aren't likely to frequent this Q/A I'm assuming the OP and others with interest are likely looking for something simpler than what your imagining ;)

You would be amazed at the preposterous things people that come here think they can do with an Arduino. Very often you just have to tell them no, and to get realistic.

From the film i think is pretty clear all of those effect is what Stark perceive, so a AR or a VR is exactly what he experience (AR advantage is that you have 0 latency on the outside image and your eyes has better contrast than any camera). He probably have VR and those effect are painted in the 3d space (the first time he put the mask, you can see the system does a full 3d scan of the room), so you can get basic result with a VR + camera + deep sensor (some smartphone). DJI has a game like this for its drone! (they use stereo camera for deep)

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Receiving DMX512 on STM32F103C8
tl;dr: trying to receive DMX512 (via a RS485 module) on a STM32 and not going well.
I am trying to modify the firmware of a commercial lighting fixture with a STM32F103C8 clone as it's MCU. It basically receives DMX and converts it into a single axis of motion and a lighting fixture with ~24 WS2812B LEDs. Unfortunately, all of the DMX libraries available (DMXSimple2, Conceptinetics) only support avr, and I don't have very much experience with the lower level hardware/library interactions.
I am looking at this tutorial because it seems easier to modify to work with the STM32, but the tutorial says

Now just do a search for "ISR(USARTn_RX_vect)" in HardwareSerial.cpp

which I can't find in the Arduino STM32 core.
Can someone help or point me towards resources about how to modify the existing libraries to work for my application?

Are you using Arduino STM32 core or STM32 HALs?

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
More effecient datalogging code
Background:
I am using a Teensy 3.6 to data log over a dozen sensors. I am printing to Serial1 for local Serial access, Serial3 for remote access (via xbee, same data is on Serial1 as on Serail3, just different physical connection) as well as datalog to SDCard (CSV format). My code is expanding and is incredibly repetitive, and I am looking for a more efficient way of writing the following. I am trying to move a lot of the rest of my code to classes using this and this tutorial, but I'm not sure this is the best option for the datalogging as there are many more strings in this portion.
The variables we are dealing with:

Live sensor value (eOilTempF)
A visual flag for if the sensor is out of bounds (checkEngine)
A auditory alarm if it's further out of bounds (eOilTempAlarm)
The max value we've recorded (engineOilStats.maximum())
The minimum value (engineOilStats.minimum())

As well as all the little bits to make it attractive and human readable for the Serial stuff.
Code:
Local serial:
Serial.print("Engine Oil Temp:\t");
Serial.print(eOilTempF);
Serial.print("F\t   ");
Serial.print("Flag: ");
Serial.print(checkEngine);
Serial.print("\t Alarm:");
Serial.print(eOilTempAlarm);
Serial.print("\tMAX: ");
Serial.print(engineOilStats.maximum());
Serial.print(" F");
Serial.print("\t\t\t\tAVG: ");
Serial.print(engineOilStats.average());
Serial.println(" F");

Xbee serial:
Serial3.print("Engine Oil Temp:\t");
Serial3.print(eOilTempF);
Serial3.print("F\t   ");
Serial3.print("Flag: ");
Serial3.print(checkEngine);
Serial3.print("\t Alarm:");
Serial3.print(eOilTempAlarm);
Serial3.print("\tMAX: ");
Serial3.print(engineOilStats.maximum());
Serial3.print(" F");
Serial3.print("\t\t\t\tAVG: ");
Serial3.print(engineOilStats.average());
Serial3.println(" F");

SD Card Logging:
logfile.print(eOilTempF);
logfile.print(",");
logfile.print(checkEngine);
logfile.print(",");
logfile.print(engineOilStats.maximum());
logfile.print(",");
logfile.print(engineOilStats.average());
logfile.print(",");

tl;dr
My datalogging section of my sketch is 567 lines of mostly repeated code, and I'm new at programming and need some tutorials/terms to google to make it more effecient.

put the two serial prints and the datalog into one function ... call the function for each parameter to be logged ... use an array for the text ... pass parameter value and index to text to the function ... log(1, eOilTempF); ... 1 points to Engine Oil Temp:\t

IIRC there's a library around that lets you use << with Serial. I can't recall what it's called though and my google-fu isn't strong enough.

simplify code by using an array to hold values ... e[ OilTempF ] instead of eOilTempF ... that way you can loop through values

@Majenko Streaming might be what you're talking about: https://github.com/janelia-arduino/Streaming. This would help a lot with taking out all of the Serial.print and extra lines, but it would still be duplicated code between Serial, Serial3, and Logfile

@TheAutomator Yeah, that's the one. It would certainly make each block smaller, and you may be able to use it with a wrapper class that mirrors the output to two serial devices.

You can combine the Streaming library with a wrapper class that sends data to multiple serial destinations.
Here's a little example:
#include <Streaming.h>

class DualSerial : public Print {
    private:
        Print *_dev1;
        Print *_dev2;

    public:
        DualSerial(Print &s1, Print &s2) : _dev1(&s1), _dev2(&s2) {}

        size_t write(uint8_t c) {
            _dev1->write(c);
            _dev2->write(c);
        }
};

DualSerial remote(Serial, Serial3);

void setup() {
    Serial.begin(115200);
    Serial3.begin(115200);
}

void loop() {
    // Both Serial and Serial3 will receive this
    remote << "The time is: " << millis() << endl;
    delay(1000);
}

The Streaming class will work with anything that inherits from the Print class, which includes the SD card's File class, so you can also use it for writing to the SD card:
logfile << eOilTempF << ","
        << checkEngine << ","
        << engineOilStats.maximum() << ","
        << engineOilStats.average() << endl;

You don't need to use pointers, eg. DualSerial(Print & s1, Print & s2) : _dev1(s1), _dev2(s2) {} and change the member variables to Print & _dev1; Print & _dev2;. In the write function change -> to .. You can initialise a reference in a constructor.

@NickGammon I know. But I like using pointers.


text:
Attach headers to servo wires?
I have these 3 wires coming from a servo motor. They're very thin and flimsy and despise staying in a breadboard.

Is it possible to add headers to these wires to make them easier to put in a breadboard? (Like the attached image) And if so, where would one procure such a thing?

The easiest solution is to put some solder on the wires to make them stiff. They usually become slightly larger than the hole, so maybe you'd better cut some of the copper wires before applying solder on them. Another solution is to solder some male pins, but again they are a bit larger than common breadboard holes

What I do in situations like that is get some of those breadboard hookup wires, like you have in your second photo, cut them in the middle (giving yourself two wires, each with a bare end, and a end with a plug on them).
Strip the bare end, and then solder it to the servo motor wires. Before commencing soldering, slip some heat-shrink tubing onto the wire. Once the wires are soldered together, move the heat-shrink tubing over the join and shrink it (with a hair-dryer, or heat gun).
You now have a plug for your breadboard which is designed to be mechanically strong, and the heat-shrink tubing over the join protects it from being flexed too much.
You could put some thicker heat-shrink over all three wires, to give additional stability.

If you do not have a hair-dryer or heat gun, you could use a lighter, but it's not recommended :)

You might even get away with some "screw-connectors" or a "wire nut" of you don't have an soldering iron.
And probably electrical tape (or just reasonable tape) if you don't have heat-shrink tubing (but you should have some :D)

I have bought a crimping tool. With the correct dice and crimps and crimp holders you get a professional finish.
The crimps and crimp holders themselves are cheap (buy in multiples of 100) but the crimping tool and dice are expensive.
It takes some practise before you make "high quality good contacting crimp" connections. You need to crimp in such a way that the strength comes from the connection between the wire insulation and the crimp and not loose electrical contact.
Also it is not so easy to find the "correct" crimps and crimp holders.
So this is only an option if you are willing to invest in your hobby (or you know someone who has ;-) )
If it is a DIY job I would go with nick solution.


text:
How do I connect this to my breadboard?
I just purchased this Grove RTC. It includes a cable presumably to connect it to a breadboard and/or Arduino, but the pin holes on this cable are much smaller than those on a breadboard or Arduino.
How/where would I connect this in the case of using an Arduino Uno?

If you want a quick temporary solution, you can probably stick 22 gauge wires in that connector, secure with electrical tape and put the other end in your breadboard.

I would get two jumper wires (with a male plug at each end) chop them into half so you now have four wires, each with a bare end and a plug, strip the wire where it was cut, and solder the 4 bare wires to your socket, and then plug the plugs into the breadboard.

Either use jumper wire, or pull the connectors from the Housing and connect them with male connectors.


text:
How do I reduce this down to a smaller, more permanent prototype?
I've prototyped a little light/sunrise alarm clock w/ an Arduino Uno and a breadboard. How do I go about figuring out what components I'd need to reduce this down in to a more semi-permanent prototype?
Obviously I don't need everything the Uno has to offer and I'd like to slim this down into a custom box I build.
But what sort of microcontroller(s) would I need to size this down? How else can I simplify it?
To be clear, I'm not trying to turn this in to any sort of finished/super-polished product. Just wanting to get out of the breadboard and in to some soldering of something a bit more set in stone.

The resistor at the top does nothing - it's legs are connected together.

In addition to AMADANON's answer, I would like to point out that if you are going as far as making a PCB (which I highly recommend), you would do well to move away from Fritzing and use a more capable schematic/layout software. I recommend Kicad, but Eagle, DesignSpark, and gEDA are other free options.

@uint128_t You can actually make decent PCB's with Fritzing... Compared with Eagle, I think Fritzing is way more easier to use. You could compare it like "Arduino IDE and Eclipse IDE". For a starter, I would highly recommend Arduino IDE. Same applies to Fritzing. He's never going to use very advanced features, so shouldn't be bothered with it. I can't see why such an (easy) board can't/shouldn't be done in Fritzing.

@Shpigford you should really check your wiring at the RGB Led's
Also, I'm not sure if your buzzer could be switched with PWM (or is active itself), you might just use the pin 9.

You could use a pro-mini instead of an UNO. Or just the bare ATMega chip kike others suggested. You could use proto-board instead of breadboard. You probably need to add resistors to those leds.

I think your LEDs are probably seriously wrong, according to the above design. I think the above design will immediately burn out your power supply and/or your LEDs, since 3 of the 4 LEDs are connected directly across the power. They will light up blue, but consume way too much power. The top one has a non-functional LED, and could be powered to light up green, which draw too much power through the Arduino and burn it out.

@Paul and AMADANON: They are NeoPixel through-hole LEDs: https://www.adafruit.com/products/1734 I've got them wired up how Adafruit suggests (at least that's my understanding from their photos). ¯_(ツ)_/¯

@AMADANONInc. FYI, regarding the resistor, Adafruit suggests adding that: https://learn.adafruit.com/adafruit-neopixel-uberguide/best-practices It's for the Arduino from the data out to the data in on the first LED.

Aha, yeah it wasn't 100% clear, they do really look like RGB led's. I'm more used to the chip-like neopixels.

To what size do you want to reduce it? It's in those cases better (and cost effective) to not use breakout boards. But to solder the chip directly. There is a RTC with built-in crystal in an 8 PDIP package somewhere, that greatly reduces the size (and accuracy). But I believe you're better off soldering it to a protoboard :) a PCB will be overkill for a one-off project, especially when using breakouts etc. How should it be powered?

@Paul Just enough to fit in a ~8x8x8 box. And I'll power it via a wall adapter of some sort. It's just going to sit on my nightstand and wake me up every morning. :)

And it's probably less about "size" and more about not tying up my Uno so I can use it for other projects.

How would you configure it? And wouldn't it be nice if it can display time? (: But I might re-look into this question tomorrow, since I always wanted to make an arduino alarm clock :)

Let us continue this discussion in chat.

@Shpigford The easiest thing to do, since the circuit is really simple apart from the arduino, in my opinion is to wire the breadboard stuff on a perfboard; with a bit of planning it can become really small. Then add an arduino pro mini, which is exactly the same as the arduino uno, but much smaller and cheaper (it just lacks the usb to serial converter, but you are not using it. This is the cheapest and easiest to make solution, in my opinion

At a bare minimum, you need a power supply, and an AtMega or AtTiny chip.
The AtMega and AtTiny's have an internal clock, 1mhz. It's not terribly accurate for timekeeping purposes (1% error, I think, as opposed to 20ppm = 0.02% for the external clock), but I see you have an RTC, so a 1% drift is probably fine (I can't see your code, so I don't know if the internal time is used for anything). Remember that you will need to adjust your code for the different clock rate, anything that uses anything time-related will run at 1/16th speed (delay, serial comms, etc). You will need to set the fuses to use the internal clock.
If your power source isn't 5v, then you need a transformer.
What type of AtTiny or AtMega you use depends on your code, and how many pins you use. I see 5 pins, they are all used as digital I think? You might get away with one of the 14-pin AtTinys. I suspect your code is probably pretty small. You can probably get away with nearly any AtTiny. To select an AtTiny, go to http://www.atmel.com/products/microcontrollers/avr/tinyavr.aspx
Nick Gammon (who will probably be providing his own answer as I type) has an excellent site on how to put the parts together, at http://www.gammon.com.au/breadboard
This site mentions programming the bootloader. On a low-memory chip, you do not need a bootloader, you can upload your program using SPI (same way as you upload the bootloader in Nick's example). Alternatively, you can use a programmer like the USBASP, which makes the whole process a lot easier. When you build your final board, I strongly suggest putting a 6-pin ICSP header (same as the 2x3 pins on the end of your Arduino board) on, to make reprogramming easier. You plug the USBASP into the 6-pin header, and click File->Upload using programmer.
ADDITIONAL:
If you want your project "really nice", you can design and etch your own PCB. If "good enough is good enough" (which for me it always is), I suggest you use stripboard (also known by it's brandname, veroboard).
In either case, spend some time thinking about your exact layout. Use a computer layout tool, and spend some time working out the best layout. I generally spend at least 5 times as much time on the layout, as I do on building the board - if a project is twice as big, I will spend twice as much time soldering, but at least 4 times as long laying it out.

Nick Gammon (who will probably be providing his own answer as I type) - I won't need to after such a comprehensive answer. :) However the page of mine Amadanon linked to certainly has some tips for you.

Several steps are required:

Define what you want to achieve in a clear and explicit manner, eg start documenting your project by writing down your decisions and design goals, for example on a project wiki somewhere. This could be the time where you explore the internet to gather several inspirational sources & modules you want to reuse.
Check that your schematic is correct, eg that first prototype works reliably. Obviously, going from prototype to a "more permanent prototype" should include checking everything works as expected (getting validation from here would be an option).
Prepare a hardware design, eg routing on your prefered CAD software. Many options exist: Fritzing, Eagle, Kicad, ... You may need help/tutorials to do this properly
Manufacture the pcb, or get your board manufactured. Several options are available (see below)
Assemble & test; depending on results, go back to step 1, 2, 3 ;)

To check that your schematic is correct, well, you can post it somewhere. As a starter: your initial post has some errors.

resistors required for LED
red (+) seems to be on GND, not +5v (!!)
using a pulldown for the button where an internal pullup is sufficient is a waste of ressource

Answer above has errors, too (as stated). So make sure your schematic & prototype work before trying to get it more permanent.
To manufacture the PCB, several options:

Veroboard & through hole components. Not small, but cheap, easy & reliable.
DIY: toner transfer method (numerous examples & howto online) :
requires a bit more time/skills, but if you plan to do several
boards/experiments, can be worth it. Can be rather cheap. Cannot
yield high precision pcb.
Note: other DIY PCB manufacturing techniques exist.
boardhouse contract manufacturing: yields perfect results (if your
design files are OK...), can't be quick & cheap (but can be either,
relatively)

Didn't even know about pullups for those buttons. Just tweaked it to do that instead. Fantastic!

I did an awful try at making a nice breadboard for it.
BUT.
I think you're better off using some perfboard, small solderable wires and an Arduino Nano.

This because the Arduino Nano has an FTDI chip, crystal and power regulator and is barely bigger than an 328 DIP package.
You could easily mount the pieces of perfboard inside/on your enclosure.
Aim to add the snooze button on top with the settings buttons on the sides.
The buzzer could be in the back or other side. The display (if any) should be in the front. Your "Neopixels" are no different than WS2812B "led's".

Ah. that capacitor is just plain wrong, but I hope you get the idea :) Also, you'll have to make each "module"  individually, I haven't dived too far in the MAX7219 but it can be adressed using SPI (only ~3 lines). An can actually update 8 (7segment) displays (4 in this picture).


text:
How do I connect velostat to an arduino?
I have some velostat that I'd like to hook up to an Uno. At the risk of sounding dense...how do I do that?
Ultimately wanting to get readings of pressure from the velostat, just not sure how or what wires to connect where.

Usually a variable resistance sensor is used in a voltage divider circuit:

In the above example a thermistor is connected to the positive supply and a pull down R1 is connected to ground.  The voltage where they meet is measured using one of the Arduino's analog inputs pins.
Choosing R1 is tricky.  If it is too large compared to the variable resistance sensor the voltage fluctuation at Vout will be too small to measure.  The same problem exists if R1 is too small compared to the variable resistance sensor.  Also, you need to mind the current through the sensor.  If the combined resistance of R1 and the sensor is too small the current may damage the sensor, over heat R1 and / or put a heavy drain on your power source.


text:
Measure voltage of data output?
I'm trying to control a few NeoPixels using a 3.3V Particle Photon.
I've got a 5V power source that I'm using to power the NeoPixels (as they require that voltage. That works fine.
Them I'm using a 74AHCT125 level shifter to increase the data signal from the Photon from 3.3 to 5.
But I'm seeing sporadic response from the NeoPixels and my hunch is there's something wrong with the power output from the 74AHCT125.
Is there a way I can measure the voltage from the data output of the 74AHCT125? I tried connecting the wire from the 74AHCT125 to my multimeter but I'm not getting any measurement from it.

Many ways. What equipment do you have at your disposal? An oscilloscope would be perfect but presumably you don't have one. Do you have a 5v Arduino, for example? Or an assortment of electronic components?

@MarkSmith No oscilloscope, but I do indeed have a 5v Arduino (Uno).

Don't they work with 3.3v signals?

@Gerben Negative: "NeoPixels powered by 5v require a 5V data signal. If using a 3.3V microcontroller you must use a logic level shifter such as a 74AHCT125 or 74HCT245."

Actually Vih should be at least 0.7*Vdd. So that would be 3.5V. I would be surprised if it would still work at 5V.

The reason your mulitmeter is not telling you much is probably because it reads some sort of averaged voltage, and your signal is flipping between low and high very rapidly.
If you had an oscilloscope you could easily have a look and see what the peak-to-peak voltage is, but since you don't you'll have to find another way.
If you have some basic electronic components at your disposal, you could knock up a simple peak voltage front-end for your multimeter - this looks like roughly the right thing.  You'll need to calibrate it with a known 5v level (i.e. see what reading your meter tells you for a fixed 5v supply) because you'll drop some voltage across the diode.
Otherwise perhaps you could use an analogue input of a 5v Arduino: write a simple sketch to measure (very rapidly!) and tell you the maximum reading every second, say.  I don't know off hand how fast the Uno will sample, or the clock rate of your Neopixels - you'll need the Arduino to sample at least as fast as your clock rate.
For the purpose of a quick hassle-free check, I'd probably plump for the first option.


text:
Soldering headers screwed up Trinket?
Last week I purchased a couple of Trinkets from Adafruit (5v micro-USB). The first thing I did was solder the headers to one of them. I did the whole setup process w/ the Arduino IDE and didn't have any issues, until I actually tried uploading the "Blink" example.
When I plug in the Trinket, I get the pulsing red light, but when I try to upload during that, I get:
avrdude: error: usbtiny_send: Input/output error (expected 64, got -5)
avrdude: verification error, first mismatch at byte 0x0004
         0x1d != 0x36
avrdude: verification error; content mismatch

avrdude: error: usbtiny_transmit: Input/output error

Then, if I press the reset button, I can't get it to "pulse" again. The red light just dimly turns on and stays constant.
I tested the other Trinket I ordered (that has not been soldered yet) and it works perfectly fine.
So, did I somehow screw up something when soldering the headers? Or do I have a faulty Trinket?
For reference, here's the trinket in question...

Is that yours? Or a stock photo from Adafruit? The soldering looks very neat.

This may help: https://learn.adafruit.com/introducing-trinket/repairing-bootloader

@NickGammon Yes, it's mine. Was my first thing to solder...ever. So wasn't sure if I somehow botched it and just didn't know. Will give the bootloader repair a try.

What kind of soldering iron do you have? How hot did you solder it and was it properly grounded?

There are what appear to be burn or melt marks on the 5 pin component labeled QTSO and on the diode near the USB pin. That could be a sign of damage due to soldering, reverse polarity, or excessive current draw through the voltage regulator (a short circuit).
Based on the fact that the light stays on solid when the reset button is pressed,  it sounds like it could also a different issue. First, turn on verbose output in the arduino IDE and post the full output when you try to upload.
Next, try disconnecting everything except the USB cable while uploading the program. If that does not fix it, it is most likely that the bootloader is corrupted. This has happened to me on multiple occasions for no apparent reason and it is pretty easy to fix.
If repairing the bootloader does not fix this, it is most likely that one or both of the components mentioned above are damaged.

The 5 pin component is the 5V regulator that provides power to the microcontroller if you're using a battery. The diode is there to just to make sure that the Vout of the 5V regulator isn't visible on pin 1 of the USB. I can say with almost 100% certainty that the components are fine. The fact that the LED is on but is dim makes me believe that the PB1 pin of the ATTINY is floating which suggests it's either ESD damage to the chip or some sort of corruption to the bootloader

On this side it doesn't seem like there's a solder bridge, although it's possible there is one on the other side if you were heavy handed on the solder.
Since you did the verification with the other unit this can't be a software or usb cable issue.
So indeed it's coming from the trinket itself. I think your best bet is to desolder the pins and check the upload again. If it's failling, try flashing a new bootloader. And if it's still not working then I guess either it was faulty from the start or you did damaged a component during the soldering.

Trying to desolder the pins is only likely to make things worse.  In theory it can be done, probably by heating them one by one with an iron and pulling each out of the board and plastic keeper individually with pliers, but it's unlikely to improve the state of the board.  Carefully sliding the plastic keeper down so the bottom of the pins could be examined makes as much sense - a little hot air (but short of soldering temperature) can help with that.  Checking for shorts electrically is probably the most sensible.


text:
Arduino LED flashes with one button press
I want the LED to flash when I press the switch once, but it keeps flashing. I tried the idea of just lighting the LED and keeping it lit with just one button press, so I wrote:
int led=13,button=12;
void setup() {
pinMode(led,OUTPUT);
pinMode(button,INPUT);
}
void loop() {
if (digitalRead(button)==HIGH)
  digitalWrite(led,HIGH);
}

and this worked; it stayed on after I pressed the button once, so for the flashing LED I wrote:
int led=13,button=12;
void setup() {
pinMode(led,OUTPUT);
pinMode(button,INPUT);
}
void loop() {
if (digitalRead(button)==HIGH)
{
  digitalWrite(led,HIGH);
delay(1000);
 digitalWrite(led,LOW);
 delay(1000);

} }

but this didn't work. It stops flashing after I remove my hand from the switch. Why is this happening?

Welcome to EE.SE. Please edit the question and use the {} tags to format your code properly. Make sure it's indented properly too. You also need to fix capitalisation in your title and in your post for legibility and credibility. Your compiler wouldn't let you away with it. Why should we? Note that your question has no electrical design element to it so it will probably be moved to the Arduino StackExchange site.

exactly i dont know whats the difference between the two cases above, the first one just one press of the bush button and the led keeps on, the second case it flashes only when i keep pressing on the bush button, and stops when i remove my hand..i want it also in the second case to keep flashing after i remove my hand

That's what I am trying to do, i understand it should execute the same way what is inside if {}..but that is not happening

If you want the LED to stay on indefinitely, remove the line that sets the LED to LOW.

I re-read your question, and it makes no sense.  ... I want the LED to flash when I press the switch once, but it keeps flashing.  .. This means that you press the switch once and you expect the LED to flash (I assume that you want it to flash one time).  The LED keeps flashing without stopping, and you do not want that.  .... At the end of your question, you say that the LED stops flashing.

Why this question is so difficult, i repeated it many times, i am comparing between the two codes although they are the same structure they behave differently, i want basically know why

Because the digital writes only apply on if (digitalRead(button)==HIGH). If you don't press the button, then the code goes:
void loop() {
}

Essentially doing nothing. Your code needs a bit more to keep track of the button press. Pseudo Code:
if button == pressed {
    int tracker=1;
}
if tracker == 1 {
    led on;
    wait;
    led off;
    wait;
}
loop

Thnx, can you please explain more, i understand that it should execute what is in if {} in the same way, so why one time it kept executing after i pressed zhe button and in the another example it stopped executing what is in if {} after i pressed the button , i can send videos if someone gives me email

Try posting your new code if you have modified yours based on this answer. Don't change your original code or the question won't make any sense. Add a new part to your question (edit the question) saying you tried XYZ and showing what that was.

This is what you need. When you pressed the button then your LED turn ON. And it still ON until you pressed the button again.I hope it will help you.
const int kPinBtn = 2;
const int kPinLed = 13;

boolean kPress = false;

void setup()
{
  pinMode(kPinBtn, INPUT_PULLUP);
  pinMode(kPinLed, OUTPUT);
}

void loop()
{
  if(digitalRead(kPinBtn) == LOW && kPress == false)
  {
    digitalWrite(kPinLed, HIGH);
    kPress = true;
  }
  if(digitalRead(kPinBtn) == LOW && kPress == true)
  {
    digitalWrite(kPinLed, LOW);
    kPress = false;
  }
}

ok,thnx, i will study this code, but still  the question, why in the first code it kept executing what is inside if {} even after i removed my hand from the push button, and in the second codeit stopped executing what is in if {} after i removed my hand from frm the switch button,although the both codes have the same structure but the difference only in what inside  if {} ,i can send vids if you didnt get what i mean

@sumerfattoum Becuase you can see that here I use one flag means boolean named kPress. By default it's value is false. When you pressed the button for the first time then code check the value of kPress. If it is false then and then your LED turns ON and that time we changed the value of kPress means now it's true. Now, your LED remains ON until not pressing the second time. This happens because of the value of kPress. Now when you pressed the second time then code check again the value of kPress. If it's true then and then it turns OFF the LED.

My friend, they are two different codes, and two different cases for my codes above , i upload the code differently to Arduino ,  there is no consideration if the button is pressed for the first and second time

The case is when I upload the first code then press the push button ,it keeps applying what is in if {} ,it means it stays on although i removed my hand from the button, now when i upload the second code and press the button it applies what is in if {} (means it flashes ) only when my hand stills on the button, but it stops flashing when i remove my hand unlike the first case although they have the structure and the difference only what is inside if {}


text:
prgramming arduino led on then off
i want the led to light at the beginning and stays like this for a while then turns off, so i wrote:
int led=13;
void setup() {
  pinMode(led,OUTPUT);
}
void loop() {
    digitalWrite(led,HIGH);
    delay (5000);
    digitalWrite (led,LOW);
}

as i understand it should start with high means on digitalWrite(led,HIGH)...and stays like this for 5000us  delay (5000)  then it should turn off with  digitalWrite (led,LOW).
but why its not working, it starts with off for afew seconds then stays on..what i understand wrong with these simple steps ????

when you reset the arduino it starts to run the code. ... it runs all the code in void setup() only once, then it runs all the code in void loop() and repeats running the code in void loop() over and over until you reset the arduino, or turn it off.   .... if you want the arduino to do something only once then do not put the code in void loop()

Thnx, can you please answer my other question here.  https://arduino.stackexchange.com/questions/47858/arduino-led-flashes-with-one-button-press/48164?noredirect=1#comment95932_48164

The "loop()" will keep repeating itself, turning the led on and off forever.
If you want turn the led on just once, put the commands for turn the led on in "setup()" section:

void setup() {
    pinMode(led,OUTPUT);
    digitalWrite(led,HIGH);
    delay (5000);
    digitalWrite (led,LOW);
}
void loop() {
}
Other method would be add a variable to count how much times the led should light. I copied the following sketch from here

int ledPin =  13;    // LED connected to digital pin 13
int alreadyBlinked = 0;

// The setup() method runs once, when the sketch starts
void setup()   {
pinMode(ledPin, OUTPUT);    // initialize the digital pin as an output:
}

// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
     if(alreadyBlinked == 0)
     {
            digitalWrite(ledPin, HIGH);   // set the LED on
            delay(5000);                  // wait for five seconds
            digitalWrite(ledPin, LOW);    // set the LED off
            alreadyBlinked = 1;
      }
}

When the variable "alreadyBlinked" is set to 1, the led will not turn on again.

thnx , i got it, i just wanted to understand the structure of the program and instructions, now for more understanding of the loop  i put once  void loop(){ digitalWrite(led,HIGH);
digitalWrite(led,LOW);}  and once    high then low, but why on both cases the led always stays on ???

Did you check the variables names? Is the led correctly connected? One pin of the led should be connected to the arduino output, and the other pin to the ground. In the first option, digitalwrite (led,LOW) is the last command, so, the led should stay off after setup. In the second option, digitalWrite(ledPin, LOW) is issued before alreadyBlinked = 1, and, since then, the led will not turn on again. I'll try this sketch tomorrow.

yes, i checked..i got it now

It immediately loops, from the digital write low to digital write high. Add a second delay after the low, so that it waits before it loops to the top again.

thnx, can you please explain to me that loop and why it acts like that...as i understand it should end with digitalwrite off... because its the last step at the programm

i added the timer after low..but what happens is a flash..it repeat itself...but i want it so start with on for a definte time then it  ends with off and stays off

That delay does not do anything but wasting 5 seconds...you need to do like:
void loop() {
    digitalWrite(led,HIGH);
    delay (2500);
    digitalWrite (led,LOW);
    delay (2500);
}

The code runs sequentially...in your code after turning off the led it immediately turns it on again and waits 5 seconds...this is so fat that you do not notice it.

i have applied this but it blinks, it doesnt stop ...i want it to stop after lighting for a few seconds

thnx for the explaining that its so fast so i wont notice

The loop function as its name suggests will happen over and over again. You need to set a flag. e.g. An integer that counts how many time the loop has been executed. Then an if statement to check and operate accordingly


text:
Pyserial and Arduino
I am trying to send an integer value from Python to Arduino. The integer value is a position given by a webcam, which will determine how many turns a stepper motor moves.
Arduino:
#include <AccelStepper.h>
AccelStepper stepper(AccelStepper::DRIVER,8,9);

void setup() {
  Serial.begin(9600);
  stepper.setMaxSpeed(1000.0);
  stepper.setAcceleration(700.0);
}

void loop() {
  int val = 0;
  if(Serial.available()){
    val = map(Serial.parseInt(), 0, 1280, 0, 551);
    Serial.println(val);
  }
  stepper.runToNewPosition(val);
}

Python:
# source: http://www.steinm.com/blog/motion-detection-webcam-python-opencv-differential-images/

import cv2
import numpy as np
import serial
import time

def diffImg(t0, t1, t2):
    d1 = cv2.absdiff(t2, t1)
    d2 = cv2.absdiff(t1, t0)
    dif = cv2.bitwise_and(d1, d2)
    return np.fliplr(dif)

cam = cv2.VideoCapture(0)

#winName = "Movement Indicator" #camera window
#cv2.namedWindow(winName, cv2.WINDOW_NORMAL)

# Read three images first:
t_minus = cv2.cvtColor(cam.read()[1], cv2.COLOR_RGB2GRAY)
t = cv2.cvtColor(cam.read()[1], cv2.COLOR_RGB2GRAY)
t_plus = cv2.cvtColor(cam.read()[1], cv2.COLOR_RGB2GRAY)

h, w = t.shape

winTest = "Test Window" #test window
cv2.namedWindow(winTest, cv2.WINDOW_NORMAL)

thresh = 100

ser=serial.Serial('/dev/cu.usbmodem1411',9600,timeout=0)
time.sleep(2)

while True:

    img = diffImg(t_minus, t, t_plus)

#    cv2.imshow(winName, img )

    nz = np.transpose(np.nonzero(img>thresh))
    a = 0
    b = 0
    c = 0
    d = 0
    avg=0
    if nz.size>0:
        a,b = nz[0]
        c,d = nz[-1]
        avg = (b+d)/2
        if 0<=avg and avg<=1280:
            print avg
            ser.write(str(int(avg))+" ")

    test = np.zeros((h,w))

    cv2.rectangle(test, ((avg-5),a), ((avg+5),c), (255), -1)
    cv2.imshow(winTest, test )

    # Read next image
    t_minus = t
    t = t_plus
    t_plus = cv2.cvtColor(cam.read()[1], cv2.COLOR_RGB2GRAY)
    print ser.readline();

    key = cv2.waitKey(10)
    if key == 27:
       cv2.destroyWindow(winName)
       ser.close()
       break

print "Goodbye"

This works OK but occasionally 'val' will take some ridiculous value, say 7182, and the motor spins out of control. I realize I can check values with an if statement before I actually write to the stepper motor, but I think my problem is with reading and writing to the Arduino.
My other issue is I feel Arduino is not receiving some of the data sent to it via serial connection. This is hard to say, as Serial.print() is slow and mostly doesn't make it through to my terminal before it's already been rewritten.

Serial.print() is slow - try a faster baud rate, like 115200?

Mr Gammon's comment about using a faster baud rate is an excellent idea.
You also seem to be sending the number as a string.  Sending the integer as binary data (using python's struct module) would also reduce the amount of data that needs to be sent - significantly for larger numbers.
import struct

...

ser.write(struct.pack('I',int(avg)))

On the Arduino Side
uint8_t buffer[4];
uint32_t position;

if (my_serial.read(buffer, sizeof(uint32_t)) == sizeof(uint32_t))
    memcpy(&position, buffer, sizeof(uint32_t));

// alternatively in one step, without error checking
my_serial.read(&position, sizeof(uint32_t));

This assumes a 32-bit integer is needed.
Maybe you only need an unsigned short - this would halve the amount needed to transmit.


text:
5V Trinket only outputting 3.3V?
Unless my multimeter is on the fritz, it would seem my 5V Adafruit Trinket is only outputting 3.3V when connected w/ DC power.
When connected via USB, totally fun. Full 5V. But if I disconnect that and connect a 9V wall adapter, the output of the 5V pinout is just giving me 3.3V.
Is that even possible?
I noticed the issue b/c my program wasn't running properly when connected via the DC adapter (but ran just fine via USB). So I tested the voltage and sure enough, 3.3V all around at basically every +/- connection.
Any ideas?

Can you measure the 9V input at the jack? Is it really 9V?

@NickGammon Yes, and it is indeed reading 9V.

I can't see from your photos where the 9V input actually gets onto the Trinket. Maybe the camera angle is a bit weird.

@NickGammon in the bottom photo if you follow the red/black, they go to the first and second inputs immediately to the top left of the trinket.

I'd prefer a photo that proved that point. Anyway, measure on the Trinket what it says between Bat+ and Gnd.

Also please photograph the underneath of the board.

The 5 things along the bottom of the last photo look light lights of some kind? What sort of lights are they? And what is the rating on the power supply (output, in milliamps or amps)?

If it's a steady 3.3V it's likely they've soldered the wrong regulator on it (or shipped you the 3.3V version). If your peripherals draw too much power, your voltage could also drop.

Unfortunately I do not have the ability to comment. What I can suggest is to look at the small 5 pin regulator and look at its markings. If the IC is marked with "QT33" then adafruit has stupidly soldered the wrong chip onto your trinket board. If it says "QT50" then the regulator is not at fault.


text:
Do I need more voltage to close this circuit?
I'm hacking together a RF-controlled garage door opener. I'm tapping the "receiving" end in to the push button wires.
When the two wires touch, it toggles the garage door motor.
I'm trying to basically "close" this circuit through a 5V Trinket Pro with...
pinMode(A0,OUTPUT); in setup and digitalWrite(A0,LOW); in the loop.
Using the multimeter, it would seem that the wires for the push button are normally closed (I think that's correct) as I get a 15v read on the multimeter when I check the current.
When I touch the wires, the current drops to 0.
My understanding was that the digitalWrite(A0,LOW); would basically "complete" the circuit, but it doesn't seem to do anything.
So, my question is: Given I've only got 5v running through the Trinket Pro, is that not enough to toggle the garage door circuit given it's putting out  15v in it's NC state?
If that's the case, is there some other way around that without needing to push 15v of power?

The Trinket really doesn't want to see 15v across one of its I/O pins. You'll do better using a solid-state (SSR) or mechanical relay to close the 15v motor-start circuit, one that can be activated by the 5v output of the Arduino pin.
Update:
A relay has 4 specs that you need to consider up front:

The coil (or switching input of a SSR) voltage, and
The coil (or switching input) current;

These are what the Arduino or an add-on switching circuit will have to drive. And:

The contact max voltage, to limit arcing when they open
the contact max current, to limit them heating,

Or, in the case of an SSR, to prevent letting out the Magic Smoke that makes them work.
If you use a relay you'll need a driver circuit between the Arduino pin and the relay, with a snubber - a diode that grounds the reverse voltage "kickback" from the relay coil when you open its circuit - also to protect the Magic Smoke in your Arduino.
You're hacking into your remote "clicker", not the garage-door tractor itself, right? If that's the case, just about anything with a 5v coil 15v+ contacts will do. The remote button only has to switch a tiny transmitter on/off. If you do need to hack into the tractor, you'll want to find out what's behind its receiver terminal. It's probably not the motor but another relay, but....
A ready source of such a relay is your/another garage door remote receiver. It has a relay in it that is already doing that job.

Is there a certain type of relay I'm looking for in regards to the 5v/15v pairing?


text:
How to wire up and trigger this SPDT relay?
How do I connect a SPDT relay to an Arduino?
It's a DC 5V Coil 6 Pin relay and ultimately what I want to do is have the Arduino trigger the relay to allow voltage to pass through.
I couldn't find a data sheet, but apparently this is the layout...
----------------------------------
|....1......2..............3.....|
|................................|
|....4......5..............6.....|
----------------------------------

2 and 5 are the 5v relay coil
3 and 6 are shorted together
3 and 1 are normally closed
3 and 4 are normally open

datasheet for HT4100F. Current through the coil is at least 30mA, which is already above the recommended current for an Arduino pin.

You can use this connection diagram with your relay

6 pin Relay pin out

Code
int Relay = 8;

void setup()
{
  pinMode(Relay, OUTPUT);
}

void loop()
{
      digitalWrite(Relay, HIGH);  // turn on relay
      delay(2000);
      digitalWrite(Relay, LOW);   // turn off relay
      delay(2000);
}

First check your relay with multi meter then find the Coil, Com, NO and NC points for correct connection.
Hope this will help you.

According to the link you've provided, the coil draws very little current, and the person posting that comment suggests that it can be directly driven by an arduino. I would hesitate to use more than one to a board without additional research in that respect.
The comment also suggests that a capacitor be placed across the coil terminals, which will also protect your circuit from excessive power draw causing drop outs.
The research I've done indicates that the digital pins can handle a maximum of 40 ma, but the recommendation is no more than 20 ma, which is lower than the specs for this relay.
If you are going to use more than one on a given arduino board, a shift register or equivalent would protect your board and give you reliable results. For a single relay, consider this resource:
https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/transistors
Some additional research may lead one to believe that even 20 ma is too much current to draw, so the transistor option is certainly the safer route.
Be certain to use pull-up or pull-down resistors, depending on your configuration with the digital pin selected.
You didn't indicate what you were going to be connecting to the N/O or N/C pins, but that won't matter if they are external to the arduino and do not exceed the specifications of the relay.

Use a driver transistor (or MOSFET, with a 4K7 pull-down), and a flyback diode with the anode at the negative terminal, and cathode at positive terminal. I used some tiny ones, which failed, so now I use ones that can handle ~0.5A, but that's probably overkill.
If you want galvanic isolation, use an optocoupler instead of a transistor - I only do this for AC. I have never needed decoupling capacitors for this type of relay.
Edit:

Wire 5V to relay positive terminal.
Wire relay negative terminal to NPN transistor/MOSFET collector/drain.
Wire NPN/MOSFET emitter/source to GND. Wire NPN/MOSFET base/gate to some digital pin. If using a transistor, do it across a 1000 ohms resistor.
If using a N-channel MOSFET add a 4700 ohms pull-down from gate to GND.
Wire diode cathode to relay positive terminal, and anode to relay negative terminal.

I would not use the decoupling cap, but if OP really wants it, go for 50-100V 10uF.

Any chance of a diagram?

The pulldown resistor is needed if you use some kind of FET transistor, but is is useless with an NPN.

Yes, you're right.

authors: Максим Ловля

authors: Роман Сагалович


text:
nRF24L01+ module fried?
I have 2 nRF24L01+ modules that were working fine then...stopped. I'm wondering if I accidentally fried one of the modules.
When I run the RF24 library GettingStarted example, this is the output of the module I believe may be fried:
RF24/examples/GettingStarted/
ROLE: Pong back
*** PRESS 'T' to begin transmitting to the other node
STATUS        = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1  = 0x0000000000 0x0000000000
RX_ADDR_P2-5  = 0x00 0x00 0x00 0x00
TX_ADDR       = 0x0000000000
RX_PW_P0-6    = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA         = 0x00
EN_RXADDR     = 0x00
RF_CH         = 0x00
RF_SETUP      = 0x00
CONFIG        = 0x00
DYNPD/FEATURE = 0x00 0x00
Data Rate     = 1MBPS
Model         = nRF24L01
CRC Length    = Disabled
PA Power      = PA_MIN

I've changed out cables and connections all the way through. I also replaced this module with the other one directly and the other worked fine.
So, my question: Is this output showing definitively that I've killed the module and just need to buy a new one? Or is there some way to "flash" or reset the module?

If one works, and the other (in the same circuit) doesn't, then it does indeed look like it's fried. There is no way of resetting these devices.

First, you should check continuity of your wiring (wire connections may become loose after some time, in particular if you move your circuits around). Then, if you have access to a digital analyzer you could check levels of all connections between Arduino and NRF (MISO, MOSI, SCK, CS, CE) and see if something is wrong.

Output says no connection with the chip, if you have not messed with it, if it has not been shorted or in any other way mishandled, I'd suspect wiring. Because I have never heard of anyone frying the neat chips neither somehow damaging. But if you give it 5V instead of 3.3V or short the board itself somehow everything is possible or just ESD above the rating killed it.

Also these devices lack any permanent configuration, power is cycled means settings are lost. It also lacks any reflashable firmware.

Assuming you have triple checked all your wiring before posting this question you should add a small capacitor between Vcc and GND near the nRF24: anything between 10uF and 100uF will do.
Rationale: these devices draw quite a decent amount of current when bootstrapping and transmitting and if they don't receive enough juice they just reset themselves showing those all zeroes settings.
They are pretty robust devices, not that easy to fry.

The nRF24L01 modules are very sensitive to electrostatic damage, I have killed three. By bit-banging the SPI lines it appears that the SCK line dies as I can detect MISO change on activating CSN (since status information should be returned whatever command is sent). I surmise the zeros you see in the status report are the first pre-clock bit repeated when there is no clock signal received. I put a 33k pull-down resistor on SCK.


text:
Model Rocket Sensors
My idea is to record the acceleration/altitude of a small model rocket launch using these sensors and record all the data onto a microSD card which I'll retrieve afterwards. I'd like to be able to plot all of the data to analyze the performance of the rocket. This data will also help compare the experimental results to the theoretical ones.
Accelerometer
OpenLog/SD Card
(Was only allowed two links so couldn't include barometer)
I have a few questions to make sure that my logic is sound when trying to design this circuit;
1.) Since the OpenLog contains the ATmega328 microcontroller I was going to use the Arduino to write the instructions to this which will initialize the two sensors and start logging data. Is this the correct way to do this? From what I could tell the other sensors did not contain any EEPROM/Flash so there was no way to store any code on there.
2.) If I have multiple sensors running at the same time is this going to cause a data conflict when writing to the SD card? Would it be possible to save two different .txt files, one for each sensor?
Thanks

Model rocket flights are short enough you might consider an SPI flash instead of a micro SD card.  Write time will likely be a lot more deterministic.   Given that most model rockets are small, you would ideally use a thin purpose-made board having exactly the components you need, for minimum weight.  Another option could be to re-use the board from a tiny quadcopter, since that has a microcontroller and an 6-axis accelerometer, and solder a tiny SPI flash to it with flying leads.   Or try to send the data over its 2.4 GHz radio, which can transmit as well as receive...

One thing about determining heigth. An accelerometer will not give you the exact height as far as I know. You can estimate the height by checking the acceleration but it won't be very accurate.

Not what you asked, but check if that accelerometer range is big enough for your rocket application.

The OpenLogger was designed to be paired with and Arduino Pro or Arduino Pro Mini and just log the serial output from one of those. You could theoretically use the OpenLogger itself to do the sensor reading and writing, however, the I2C pins that your sensor needs haven't been broken out on the OpenLogger.
This means if you really wanted to make this happen, you would have to hand solder those pins and break them out yourself. After that the process is pretty straightforward. SparkFun provides both the source code and directions on programming it.
If trying to break those out is a little too tricky, you can either pair it with one of those Arduino models and use it to read the data, or find another similar logger device that has more pins broken out.
Two answer the second part of your question, reading multiple sensors isn't a problem. Usually the way these sensors work is you send a request for data to them and they return the reading, so you would just request from the first sensor, request from the second sensor, write out to the file.
You can write to two different files no problem eiteher. I would not however, recommend writing to two different files. Switching from one file to another, back and forth introduces a little extra overhead which will slow down your loop. In rocketry, things happen very fast, and you'll probably want keep your loop running as fast as possible. I would recommend just writing to a single file and include data from both sensors probably something along the lines of time,accelX,accelY,accelZ,bar.

Thanks for the help, glad I'm somewhat on the right track. Could you elaborate what you mean by breaking out the pins? Do you mean that I would need to wire the sensors up individually to the components on the OpenLog board such as the ATMEGA328 chip or SDsocket? Would I not be able to wire it using the predetermined pins that were labeled on board? I considered using an Arduino but my concern was that it wold be too big to fit inside a rocket. Maybe I could try to find a 'Mini Microcontroller'.

To use the open logger you would have to wire it straight to the pins on the chip. If you look at this picture you'll see that not all of them have trace coming out from them (and some of those pins are the ones you need). There are plenty of options for small arduino compatible boards: Arduino Micro, Adafruit Trinket Pro, Sparkfun Pro Micro to name a few, Then all you would need to do is wire in a micro sd breakout like this.


text:
Tone() working on all digital pins?
Looking at my Arduino Uno board, it appears the digital PWM pins are #11, #10, #9, #6, #5 and #3.
When playing around with the Theremin, it seems that the Tone() message works on all pins regardless of whether they are marked PWM or not?
Can anyone explain what is happening or how this is possible?

The Tone library doesn't use the PWM mode timer functions on the atmega, instead it uses an interrupt routine to toggle the pins. You can find the source code for Tone libary here for reference:
https://github.com/johnmccombs/arduino-libraries/blob/master/Tone/


text:
SoftwareSerial Write to return Read in Serial Monitor?
Hoping someone can help me out in my conundrum here...
I currently am testing the SoftwareSerial library out to understand how I may use it in my project.
I have a wire running from pin 6 to pin 9, so that the TX talks straight to the RX.
I have written the following:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(6,9); //RX = 6 TX = 9

void setup() {

  Serial.begin(1200);
  mySerial.begin(1200);
}

void loop() {

  mySerial.write('F');
  delay(100); // attempting to allow time between write and read commands

  while (mySerial.available()>0) {
  Serial.println(mySerial.read());
  }
}

The whole point is just to see 'F' return in the Serial Monitor.
The output, unfortunately, is absolutely nothing! If I omit the while(mySerial.available>0) I just get -1 's down the lines of the Serial Monitor.
Thank you in advance!

SoftwareSerial cannot talk to itself. Since it is implemented in software and not hardware it can either send or receive at one time, but not both.
Look at the code for write in SoftwareSerial:
size_t SoftwareSerial::write(uint8_t b)
{

...

  cli();  // turn off interrupts for a clean txmit

...

  // Write each of the 8 bits
  for (uint8_t i = 8; i > 0; --i)
  {
    if (b & 1) // choose bit
      *reg |= reg_mask; // send 1
    else
      *reg &= inv_mask; // send 0

    tunedDelay(delay);
    b >>= 1;
  }

...

  SREG = oldSREG; // turn interrupts back on

...

}

Since it turns interrupts off, and interrupts are needed for it to detect incoming data, therefore it cannot detect incoming data while it is sending.

You're the best. Thank you.
Hypothetically, if I make a big delay between the TX and RX, shouldn't that solve the problem? Say,1 full second?

It would in hardware but not software. For SoftwareSerial the code actually goes into a timed loop (to receive) similar to the timed loop to send. It can't be doing both loops at once. If you connect SoftwareSerial to a HardwareSerial port it should work (the hardware works in the background).

Exactly what I needed. Thanks! You're the best!


text:
Is it correct to use pulseIn() in ISRs?
Since it is not right to use millis() in an ISR to calculate duration of the input, Is it correct to use pulseIn()?

Why can't you use millis inside and ISR? I don't see why not.

Using millis() inside an ISR is fine. Waiting for its return value to change is not.

@Gerben@Edgar see comments on Nick's answer.

Can you accept my (or someone's) answer please so that this question is not bumped to the top as unanswered every month? Thanks! The page for attachInterrupt has been corrected.

It is quite OK to use millis() or micros() inside an ISR. In fact that is an excellent time to do it, because you are recording the time of the event shortly after it happened. Make sure the variable you are saving it to is unsigned long and volatile. Eg.
volatile unsigned long whenItHappened;
volatile bool eventHappened;

void myISR ()
  {
  whenItHappened = millis ();
  eventHappened = true;
  }

Now in your main loop you can test the eventHappened flag, so you will know if this event has happened, and whenItHappened is when.
It is not a good idea to use pulseIn() because that can wait quite a long time for a pulse. The default timeout for pulseIn is 1 second, which is far too long to wait inside an ISR.
If you want to time something (eg. how long it takes a ball to cross a sensor) use the interrupt twice, once to find the first event, and again to find the second.

Example
Example code which times how long a ball passes a sensor:
const byte LED = 12;
const byte photoTransistor = 2;

unsigned long startTime;
volatile unsigned long elapsedTime;
volatile boolean done;

void ballPasses ()
{
  // if low, ball is in front of light
  if (digitalRead (photoTransistor) == LOW)
    {
    startTime = micros ();
    }
  else
    {
    elapsedTime = micros () - startTime;
    done = true;
    }

  digitalWrite (LED, !digitalRead (LED));
}

void setup ()
{
  Serial.begin (115200);
  Serial.println ("Timer sketch started.");
  pinMode (LED, OUTPUT);
  attachInterrupt (0, ballPasses, CHANGE);
}

void loop ()
  {
  if (!done)
    return;

  Serial.print ("Time taken = ");
  Serial.print (elapsedTime);
  Serial.println (" uS");
  done = false;
  }

That code used micros() for a more accurate timing.

Reference

Interrupts

But the doc page (https://www.arduino.cc/en/Reference/attachInterrupt) says its incorrect : "as delay() and millis() both rely on interrupts, they will not work while an ISR is running."

It also says (higher up the page): Inside the attached function, delay() won't work and the value returned by millis() will not increment. That is my point. millis() won't increment but it will return an accurate figure. I'll raise a bug report about the "will not work" phrase further down the page.

See: https://github.com/arduino/Arduino/issues/3700

You shouldn't really use anything much in interrupts.  Using anything that runs for a period of time is usually bad since no other interrupts can happen at the same time.
It is more normal to use the interrupt to set a flag that is then checked within your main loop to determine what should be done.