How do I connect a function generator that generates an analog signal to an Arduino Uno?
I don't know how to begin, so could you also tell me the settings for the function generator, e.g. its amplitude, frequency, etc, that won't damage my Arduino?
I plan to visualize the output on Processing.
Agilent 33220A Function Generator
(source: sonoma.edu)
3 Answers 3
Confirm with an oscilloscope
When I connect my function generator I (削除) usually (削除ここまで) always make sure that the output is in the range 0 to 5V, with my oscilloscope. The default is probably more like ±2.5V - but I don't have an Agilent so you would have to check. Press the Ampl
button to check. (Mine reads 5VPP).
You can see from the above image that we indeed have (roughly) 5VPP - and that there is a -2.56V component, which will damage the Arduino, being negative.
Add an offset
So press the Offset
button and add a 2.5V DC offset. Now the voltage jumps 2.5V and is between 0 and 5V:
The scope confirms that the minimum is 80mV and the maximum is 4.96V, which is in range for an Arduino pin (assuming you are running an Arduino at 5V, which is not always the case).
Now you should be safe to experiment with different frequencies and wave-forms. Just leave the Amplitude and Offset alone. :)
Extra precautions
You could feed the function generator through an input protection circuit, just in case you absent mindedly forget to carry out the appropriate steps.
The zener diode will conduct negative voltages to ground (dissipated through the 1k resistor) and will also limit positive voltages to around 5.1V.
I don't know how to begin, so could you also tell me the settings for the function generator, e.g. its amplitude, frequency, etc, that won't damage my Arduino?
That is not an Arduino question. That is a question about how to operate the function generator. Please check the users manual. You need to set the voltage output (DC + AC) so that it matches the Arduino.
An analog signal should go to an analog pin on the Arduino (not pin 8). It is also important to connect GND.
Cheers!
-
Using the built in USB interface would make things a lot simpler... :-)Greenonline– Greenonline2016年02月04日 06:39:10 +00:00Commented Feb 4, 2016 at 6:39
-
2Depends on how the OP wants to connect the function generator. My interpretation is somewhat different; Function Generator => Analog Pin (Arduino) => Processing (Serial).Mikael Patel– Mikael Patel2016年02月04日 06:43:24 +00:00Commented Feb 4, 2016 at 6:43
-
Looking at the Agilent 33220A 20 MHz Waveform Generator User's Guide, I can see that the Function Generator has a USB port. If you have, or can get hold of, a USB Host shield for the Arduino, you should be able to link the two together physically. Then, using the USB Host Library for Arduino, you could get the two talking to each other.
Alternatively, if you fancy a bit more hard work, then you could get a MAX3421E, and wired it up yourself as an interface, but I wouldn't recommended it.
Note: If you have an Arduino Due (I know that you say that you have an Uno, but just in case) then you could use the USBHost library to connect the two directly, without the need for a USB Host shield.
Regarding, getting the two to talk together, that may not be exactly easy. From the manual I can see that the PC software can auto-configure the function generator, however, for receiving data it may not be so easy. You appear to have to send a GTL command to get the data sent to the USB (p251, and onwards, of the manual). Good Luck! :-)
-
1
I can see that the Function Generator has a USB port.
- I think he wants to generate test signals, not control the function generator.2016年02月04日 07:04:54 +00:00Commented Feb 4, 2016 at 7:04 -
@NickGammon - Yes, re-reading the question, I can see that I got a little carried away! :-)Greenonline– Greenonline2016年02月04日 11:56:06 +00:00Commented Feb 4, 2016 at 11:56
From googling i know it should be connected to pin 8 on arduino.
- all of the pins can take inputs. If you are trying to measure analog inputs you mean pins A0 through to A5. Do you have a specific reason for mentioning pin 8?