Show Posts
Pages: [1] 2
1  Products / Arduino Due / Re: Audio (yes, I know) on: September 14, 2014, 07:01:25 pm
The Arduino code for the Due can be optimized into  "initialize" and "read" functions, however IMO for the speeds mentioned in the first post (8KHz), analogRead() is more than capable.

I have used analogRead() inside of a interrupt service routine and it works great at 22.050 KHz (search arudino due interrupt to get the code for that ISR).

You shouldn't need to scale the ADC value from 10 bit to 8 bit yourself if you use analogReadResolution( 8 )

I would take the data you've collected, save it into a file and analyze it with an audio program that can interpret RAW data. Maybe you've got a big endian <-> little endian thing going on.

If there's anyway possible to use the DAC to generate a sine wave and loop it back to the input, then you could see if your data output represents a sinewave and eliminate the mic as a problem.

Throw a sinewave generator and ADC code in the same ISR. Then analyze the data on the receiver. That's where I'd start.
2  Using Arduino / Programming Questions / Re: Convert two integers to a long on: September 14, 2014, 06:36:12 pm
great catch. That probably explains why some of my prior bit manipulation didn't work.

result = high;
result = result  << 16;
result += low;
3  Using Arduino / Programming Questions / Re: Convert two integers to a long on: September 14, 2014, 06:20:21 pm
how about

long result;
int high;
int low;

high = 0x1234;
low = 0xabcd;

result = (high << 16) + low;
4  Using Arduino / Programming Questions / Re: Timer2 Interrups REFUSE to work! :( on: September 18, 2012, 10:01:23 pm
I also didn't see anything referring to #include <interrupts.h> (I didn't need to in my case) nor interrupts() or sei()
5  Using Arduino / Programming Questions / Re: Timer2 Interrups REFUSE to work! :( on: September 18, 2012, 09:52:57 pm
Consider this code which "checks" the value of foo, a global variable that gets updated via ISR
unsigned int foo = 0;
//update foo here

void loop ()
 while (foo == 0); /wait for foo to get updated
//do stuff after foo gets updated

Your while loop would never exit, because the compiler will read from the register(memory bank) which previously held "latest" value of foo instead of force reading the actual value from RAM.

Check out Nicks awesome page about interrupts:

Is there any way you can add in some debugging functions to send some output to the serial port, etc? I think that will be the easiest way to debug whats going on instead of just eye-balling the code and making changes
6  Using Arduino / Programming Questions / Re: Timer2 Interrups REFUSE to work! :( on: September 18, 2012, 08:59:43 pm
I don't see any variables being declared as volatile. If an interrupt service routine is going to update variables they should be marked as volatile.

seconds -- TIMER2_OVF_vect
minutes -- TIMER2_OVF_vect
hours -- TIMER2_OVF_vect
show_the_time -- INT0_vect
7  Using Arduino / Project Guidance / Re: Electronic Door Lock keypad with Arduino on: September 18, 2012, 08:52:32 pm
If there is an H-bridge, the outputs will be connected to the black and red wires that go to the motor/actuator.

I can't tell from the pictures taken what drives the actuator.
8  Using Arduino / Project Guidance / Re: What plug do I use to connect 3 pin plug to arduino board? on: September 18, 2012, 08:39:57 pm
About the sensor:
What 3 pin plug on what sensor? Analog or digital?
9  Using Arduino / Networking, Protocols, and Devices / Re: HELP HELP HELP ETHERCAT on: September 13, 2012, 05:06:53 pm
EtherCAT slave implementation guide:

I would suggest becoming a member of the EtherCAT Technologies Group for more resources.
10  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Sniffer on: September 13, 2012, 05:01:39 pm
You will need to see if the ethernet interface chip supports promiscuous mode or something similar (that's what it's called on computers).

As far as libraries that are already developed, your top two choices will be WIZnets W5100 or Microchips ENC28J60
11  Using Arduino / Installation & Troubleshooting / Re: Arduino UNO, all of a sudden can't upload programs on: September 13, 2012, 04:55:52 pm
Check the "Devices and Printers" icon in the control panel. You should have it listed there and it's properties will tell you the COM port its on as well as let you switch it.

If not, check the Device Manager under "Ports (COM AND LPT)" Make sure it isn't disabled and doesn't have any error codes.
12  Using Arduino / Programming Questions / Re: Bitshit question. on: September 13, 2012, 04:35:39 pm
if that Supported_PID20 has 00010000000000000000000000000000 in it and unsigned long

That is a VERY large number, much larger than can fit into a unsigned long. Is that decimal or binary representation?

13  Using Arduino / Project Guidance / Re: gracefully shutdown a windows computer with arduino on: September 12, 2012, 08:25:18 pm
Windows XP provides an interface for a uninterpretable power supply shut down via a com port.

You could configure windows to look on the arduino com port, and emulate the APC smart protocol
14  Using Arduino / Project Guidance / Re: Driver Mosfet on: September 10, 2012, 10:54:48 pm
From a low cost standpoint, I would probably go with a logic-level N channel mosfet. This would allow me to switch the load between ground or open circuit (which would actually have a flyback diode of course).

You could also switch the power supply to the circuit, commonly done using a P channel mosfet (but possible with an N channel).

If you have problems getting logic-level mosfets, then the mosfet driver is the way to go, such as the one you have mentioned. There are other needs that require mosfet drivers as well.
15  Using Arduino / Project Guidance / Re: how to generate less than microsecond delay? on: September 10, 2012, 10:42:25 pm
Check the microcontroller data sheet. For the Arduino Uno with the ATmega328, the PDF says the NOP instructions takes 1 clock cycle.

For a 16 MHz clock, 1 NOP takes 1/16MHz to complete,*10^6))+seconds+to+nanoseconds
Pages: [1] 2