Show Posts
Pages: [1] 2 3 ... 35
1  Using Arduino / Audio / Re: toneAC v1.2 - Twice the volume, higher quality, higher frequency, etc. on: September 11, 2014, 12:07:52 pm
My apologies, I was not clear.

I meant the frequency resolution. A quick look at the files I downloaded would indicate that the resolution at lower frequencies the frequency resolution is better than at some point where the prescaler must change, and there are larger steps in the frequency.

Kind of like how millis() is milliseconds and has an actual resolution of 1ms, but micros(), although it is microseconds and can be given any number, has an actual resolution of 4us.

Actually I'm looking to use this for an RFID card reader in the 125kHz to 134kHz range. I thought I might try some frequency hunting to look for the tag's actual resonant frequency.

That's correct, the steps between frequencies gets larger as the frequency increases.  In about the 125 kHz to 134 kHz range, there will be these frequencies: 123,077, 125,000, 126,984, 129,032, 131,148, 133,333 & 135,593 Hz (basically about a 2 kHz step).  As these are based on the clock frequency of the microcontroller, they will also be off depending on your oscillator and ambient temperature (which is why I gave one below and one above the range you're looking for).

Basically, toneAC can generate frequencies in that range, but if accuracy is important, the ATmega is not an ideal platform as it won't be very granular in frequency and it will vary from board to board based on the microcontroller timer.

Also, I would suggest using the frequencies listed above as they will calculate exactly to a different frequency.  For example, if you told toneAC to generate a 127,000 Hz frequency, it would generate a 129,032 Hz frequency instead.  So, you probably won't get the results you're looking for.  In other words, you should use the above frequencies with toneAC and not any in-between.

I hope this answers your question better.

Tim
2  Using Arduino / Audio / Re: toneAC v1.2 - Twice the volume, higher quality, higher frequency, etc. on: September 09, 2014, 05:14:18 pm
Thanks!

Pardon my ignorance, but... what is the resolution? Specifically at the >100kHz range?

The resolution is always 1 bit, it's a square wave.  That's all that toneAC or just about any other audio library will do on the Arduino, a square wave.

I assume you're trying to output a sound sample?  That would require an analog waveform, which the Arduino is not good at all at doing (nor could it ever hope to output anything of any quality at a 100kHz range).

Tim
3  Using Arduino / Audio / Re: toneAC v1.2 - Twice the volume, higher quality, higher frequency, etc. on: September 05, 2014, 03:18:47 pm
First off, thank you for writing this.

I have a few questions, if you don't mind.

What is the maximum reliable frequency this can output? I'm hoping that you'll say it can go up to 150kHz for RFID and some other projects I've got in mind.

Will it work on a Nano V3.0? I'm guessing that it can because both it and the Uno use the 328p.

The maximum frequency is VERY high, but depends on the speed you're clocked at.  Here's a link to the maximum frequency based on microcontroller clock speed:

https://code.google.com/p/arduino-tone-ac/wiki/toneAC_Frequency_Limits

So yes, toneAC will work at EXTREMELY high frequencies, even when running at lower clock speeds.  A Nano running at 16 Mhz can produce up to 2.66 MHz output with toneAC.  Even at 1 Mhz, you can generate a 166.66 kHz output.

And yes, Nano v3.0 will work just fine with toneAC, it works with all ATmega chips.  The Nano uses a ATmega328 so it's exactly like the Uno (uses pins 9 & 10).

Tim
4  Using Arduino / Audio / Re: toneAC v1.2 - Twice the volume, higher quality, higher frequency, etc. on: September 02, 2014, 08:57:58 am
Hi,

I've read that piezzo buzzers (magnetic ones too) can generate a "back emf" when they are heavily shocked (Arduino box falling on the ground for instance) which induces enough voltage and current to destroy the microcontroller output. One should add a diode in parallel to the buzzer to prevent this.

What do you think about this aspect?

Thanks in advance smiley-kitty

A piezo can work just about as well as a microphone and a speaker.  So, a shock like dropping or tapping it can generate a large voltage pulse that will back-feed to the microprocessor.  While the voltage is high, the current is probably very low.  So even then, it's not very likely.  However, it's always good to provide some level of protection.

But, installing a diode is not the solution to this.  It's better to install a resistor to limit the back voltage.  With toneAC I suggest using a 100 Ohm resistor, which will limit the voltage and prevent a problem.  It's even more important NOT to use a diode with toneAC as it uses an alternating current and therefore the piezo will only ever "push" and never "pull", nullifying most of the advantages that toneAC has.

In any case, use about a 100 Ohm resistor inline with one of the pins when using a piezo buzzer.

Tim
5  Using Arduino / Sensors / Re: Help interfacing with this ultrasonic sensor - DYP-ME007Y on: August 06, 2014, 12:15:39 pm
Hi Tim, I have a problem interfacing my DYP-ME007Y. When I tried the petervojtek's success code, it just show the same distance all of the time (that is 16 cm). Can anyone help me?

Btw, I don't know what type of my DYP-ME007Y, which is PWM or RX-TX or switching. But I also have tried to connect it with RX-TX in my arduino uno. I confused how to use it via RX-TX mode, so I just set up the baudrate according to datasheet and then read the RX. And I got a constant byte 152 in ASCII. So, I frustated now. Need help very soon, friends!

Thanks a lot!

It sounds like you have  the serial version, which means it won't work with newPing.

Tim
6  Using Arduino / Displays / Re: BarGraph Help on: August 05, 2014, 01:07:14 pm
I love your work.
Why not do something with BarGraph but with something bigger than 4bytes??
I have a LCD 16*2 , but it is frustrating to have something so small. In such a large LCD.

Can you help me to modify the BarGraph  get much higher?

I don't follow what you're asking.  The display is only capable of creating a limited number of unique characters, which LCDBitmap uses to create the graphics.  It only does a 20x16 display because that's all the display can do.  It's a display limitation, not a library limitation.

Anyway, the barGraph() method can do up to 20 bars from 0 to 16 pixels long each.  It can't display more, it's not possible.

Tim
7  Using Arduino / Sensors / Re: Help interfacing with this ultrasonic sensor - DYP-ME007Y on: June 02, 2014, 04:42:16 pm
TX surely wont work with NewPing library.

Correct.  Also, using NewPing is typically much easier to get the sensor working than doing all the pin high/low/pulsein stuff.  NewPing takes care of that for you, and does so in a more direct way.

Tim
8  Using Arduino / Sensors / Re: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 on: June 02, 2014, 04:39:14 pm
I did some reading on SR-06 and I found out it does the corrections on the sensor itself... So yea, your lib does support that:)

I think that's what I said, or at least I meant to say that.

Tim
9  Using Arduino / Sensors / Re: PIR sensor always HIGH on: June 02, 2014, 12:29:24 pm
I only used a connector because I didn't have a  female-male wire. I measured and there isn't any shorts between the pins.
I'll measure again tonight just to be sure.

The wiring order I used is GROUND, SIGNAL, POWER (black, blue, red) when you look at the back of the sensor and the pins are on the bottom.

Thanks,
Andrei

Do you have a solderless breadboard?  That would be a better way to start to make sure you don't have somthing buggered up.

Tim
10  Using Arduino / Sensors / Re: Ultrasonic sensor HC-SR04/SR06 to measure water level on: June 02, 2014, 09:37:29 am
Hello!

I just got SR04 sensor and is working flawlessly with your library...

ping_mediana is working nice and my results are about 1cm off scale, but that I can fix with software calibration.

As far as my sketch goes, I will be checking my water level every minute or so, since it will also be used for alerting in case something goes wrong and water starts to spill out of the tank...

During water change it will be running non-stop, but that will take 30min every week, no more....

Matej

Are you measuring from the front or the back of the sensor?  The sensor itself is about 1cm in length.  If there's a distance issue, it's with where you start the measurement.  Also, NewPing rounds to the closest cm.  So 10.5 would round to 11.  Therefore, it can easily appear to be 1cm off once you factor in where you start your measurement and up to 1/2 cm rounding.

Tim
11  Using Arduino / Sensors / Re: PIR sensor always HIGH on: June 02, 2014, 09:32:02 am
Thanks for the answer.

My sensor looked a lot like the one in the tutorial so I just wired it up like there.  I don't use any interface.. it's plugged straight into arduino.
Also, this is the only way I've  wired it. In my pics I have
Red = 5V
Black = GND
Blue = Ouput

For your experience, what other wiring should I test?

You're using jumper wires soldered to a connector which is then plugged into the PIR sensor.  That can be a potential problem and one cannot see how things are attached due to it.  You could have a short in that connector.  Instead, just use a solderless breadboard and jumper wires.  Also, the order on the PIR sensors are opposite on 50% of them.  Some are GROUND, SIGNAL, POWER, and others are POWER, SIGNAL, GROUND.  I've never seen one that was POWER, GROUND, SIGNAL as you list.

Basically, throw away everything you have between the sensor and the Arduino.  Plug the PIR sensor directly into a breadboard, and use jumper wires to wire up each pin.  Then, detail the pin ORDER and the SIDE you're looking at on the sensor.  I fear you have it wired wrong or there's a short as it is now.  Which is why things are not working correctly for you.

Tim
12  Using Arduino / Sensors / Re: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 on: June 02, 2014, 09:21:30 am
Does NewPing library supports temperature compensation with SRF06 sensor?
Can it automatically read temperature and use it in it's calculation?

lp, Matej

The sensor does not output the temperature.  It simply reads the temp and adjusts the output based on the temp.  So yes, NewPing works along with the thermostat and is used in the calculations.

Tim
13  Using Arduino / Sensors / Re: VEX Ultrasonic Range finder + Arduino UNO on: June 02, 2014, 08:24:47 am
Hi all,
I read some other forums on how to get the vex range finder to work with the arduino uno. I am having some troubles though. The only numbers i have been able to get are 5 digit numbers in the 30,000 range. This is the code I used that supposedly worked for someone else but gives me these funky numbers that dont even correspond to how close an object is to the range finder.

First, use the NewPing library instead of rolling your own, you're project will work so much better.

Secondly, did you notice that it's not displaying "Duration:  " either?  You probabaly really mean for that line to read:

Code:
Serial.print("Duration:  ");

But, it's not showing "Duration:" in your output.  In other words, this has nothing to do with your sensor.  You can't even get your sketch to output "Duration:" to the serial port.  Notice in your sketch where you open the serial port, you specify 9600 baud.  My guess, is that you've set a different baud rate in the Arduino IDE.

Basically, your sketch is set to 9600 baud and your computer program (Arduino IDE) is set to some other speed.  So, the data is garbage.  My guess is if you make both the baud rates the same, it will at least show "Duration:".  Then and ONLY then can you start diagnosing a possible problem with your sensor or the sketch.

Tim
14  Using Arduino / Sensors / Re: PIR sensor always HIGH on: June 02, 2014, 08:16:42 am
Hi,

I'm trying to connect a PIR sensor to my Arduino Uno board. The sensor was purchased from amazon and looks a lot like HC-SR501 (uses a BIS0001 chip).
I followed this tutorial https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor/using-a-pir   including the source code there.

The problem is I always have the input pin on HIGH. I tried adjusting the sensitivity but with no luck. I attached a picture of my setup.

The weird thing is, I think somehow the sensor works without the + and GND pins plugged in (just the output pin).  Sometimes it behaves weird, but most of the times it detects my palm.


PIR sensors are pinned two different ways (totally opposite).  I can't tell by your pictures if you have it pinned correctly.  Also, there's an added complexity because you added an interface.  Instead, plug the sensor into a solderless breadboard and wire it up that way.  This will remove a possible reason why it's not working.

I've spent countless hours working with PIR sensors.  They're VERY simple and work very well.  That's why I believe the problem has to do with how you're connecting it.  Or, it's possible you have a dead sensor (maybe from wiring it wrong at some point).  I have dozens of these sensors and have used them on all kinds of projects.  I've never had a dead one or one that failed.

Tim
15  Using Arduino / Sensors / Re: Ultrasonic sensor HC-SR04/SR06 to measure water level on: June 02, 2014, 07:36:45 am
I will be using it to measure water level in a fish tank. I will measure water level, so I will know when to add water that evaporated and to know when to stop/start pumping when changing water.

The only problem I see, can be that the surface of the water is wavy and that will affect measurements... But then again, that's way I will use ping_median.

How long does it take to make a measurement?
One second?
Half second?

lp, Matej
ping_median() sends out a ping every 29 ms.  Because the surface isn't still, and the water lever doesn't change quickly, I would suggest doing many iterations to get the median.  Let's say 15 iterations.  Even at 15 iterations, it will take less than a half second.  One ping at a short distance may only take 5ms.  The only reason it would take almost a half second is because it's doing it so many times and waiting for echos to dissipate.  You may even want to do 30 or more iterations for even more stable results.

I would imagine your sketch doing a measurement a couple times a day at most and put the Arduino to sleep between sensor readings.  There's no reason to be sending high-frequency sound into your tank which your fish could sense.  You wouldn't want to be possibly aggravating your fish by a constant high-frequency speaker blaring all the time.  Sounds a bit like torture.

You may also want to consider a float switch (think the ballcock in your toilet tank).  Maybe a little low-tech, but it should work well.

Tim
Pages: [1] 2 3 ... 35