1

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

4
  • I haven't connected it yet, am scared to break the board. – Ηλεκτρολόγος Μηχανικός Feb 4 '16 at 6:21
  • From googling i know it should be connected to pin 8 on arduino. – Ηλεκτρολόγος Μηχανικός Feb 4 '16 at 6:22
  • What do you want to achieve? Please describe the overall circuit. – Mikael Patel Feb 4 '16 at 6:42
  • 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? – Nick Gammon Feb 4 '16 at 8:17
2

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).

Default operation

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:

With 2.5V offset

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.

Input protection

The zener diode will conduct negative voltages to ground (dissipated through the 1k resistor) and will also limit positive voltages to around 5.1V.

0

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!

3
  • Using the built in USB interface would make things a lot simpler... :-) – Greenonline Feb 4 '16 at 6:39
  • 1
    Depends on how the OP wants to connect the function generator. My interpretation is somewhat different; Function Generator => Analog Pin (Arduino) => Processing (Serial). – Mikael Patel Feb 4 '16 at 6:43
  • Good point! :-) – Greenonline Feb 4 '16 at 6:52
0

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! :-)

2
  • 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. – Nick Gammon Feb 4 '16 at 7:04
  • @NickGammon - Yes, re-reading the question, I can see that I got a little carried away! :-) – Greenonline Feb 4 '16 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.