Generating Bipolar RZ Signals with Nano

Hi everyone,

So, I'm looking to be able to generate bipolar RZ signals that look like this (I'm making a signal generator):

but I'm not really sure how to go about getting the -5V part of the signal.

I'm using a Nano, and the only external powering comes from the USB cable. At the generator's fastest speed, the width of a bit is around 20us i.e. the line should change voltage every 10us (though I admit I'm still fighting with the Nano's code to get a pin to toggle that quickly with any logic in between pin toggles lol).

I don't know much about electronics (definitely have more experience with the programming side), but after searching the forum I researched op-amps (which didn't sound super feasible for this project, because the only external voltage source will be the USB cable) and charge pumps (which sounded more feasible, but I don't know for sure). Again though, since I don't know a whole lot about electronics yet, I 100% acknowledge my conclusions may have been completely wrong.

Could you point me in the right direction? Thanks so much!

What I would do, find out (you didn't tell us!) what the protocol or devices it is used with, and start looking at what other people did. If it's an established protocol like RS232 for example, there may be IC's that have been designed and available to do the hardware part.

You shouldn't even start thinking about coding until you do that.

A level shifted signal of 0-2.5-5V can be generated from 2 output pins connected with 2 resistors.

For true +- polarity and 10µs pulse duration I guess that a sophisticated hardware is required with tight coupling to the signal receiver. Opamps tend to be slow or oscillating, RS-232 drivers have limited rise time by specification for easy transmission over unterminated lines.

I'd consider using a different line transmission protocol instead of bipolar RZ.

For the fastest possible port pin manipulation, use direct port access.

To set/reset (for example D4 (pin 4 Port D)) on the Arduino Nano use

PORTD |= (1<<4); //set high
PORTD &= ~(1<<4); //set low
PIND = (1<<4); //toggle

aarg:
What I would do, find out (you didn't tell us!) what the protocol or devices it is used with, and start looking at what other people did. If it's an established protocol like RS232 for example, there may be IC's that have been designed and available to do the hardware part.

You shouldn't even start thinking about coding until you do that.

Thanks for replying so quickly!

Sorry, you're right, I should've said. The protocol is ARINC429 (a protocol for avionics data).

It didn't even occur to me to look for IC's... duh. Yeah, there are some, so I think I'm gonna pursue that path.

[I've more-or-less successfully generated some ARINC717 (another protocol for avionics data, but the voltage range for a single line is 0 to +5V, so there was no hardware limitation there), so any of the code I have so far was from that.]

Thanks again for your help!

Thanks for your replies too, DrDiettrich and jremington.

I can't really escape bipolar RZ--that's the signal needed for ARINC429, but I didn't specify that in my original post, so that's my bad.

I've used direct port manipulation before and it works great! In this case it's not the act of pin-toggling that's the problem; my other logic just takes too long to execute, which I'll deal with.

Thanks again!

but I'm not really sure how to go about getting the -5V part of the signal.

You'll need a -5V power supply/source. There are circuits for generating a negative voltage from a positive voltage if you're stuck with a USB power supply or something like that.

It's not exactly what you're looking for but the MAX232 chip can generate approximately +/-10V (at low current) from a +5V supply. (It's designed for RS-232).

I assume you can buy RZ driver chips but I'm not familiar with any of them. A [u]Class-B audio amplifier[/u] powered from a bipolar power supply can drive positive, negative, or ground (or anywhere in-between) but that's analog so it's not exactly what you're looking for either.

I'm making a signal generator

I've never seen a signal generator, function generator, or pulse generator that will do anything like that.

For the fastest possible port pin manipulation, use direct port access.

I once did a little speed test with an Arduino Uno. I just used regular C++ digitalWrite() to write high-low-high-low 20 times before looping. I got a pulse time of 3.3uS. Of course, any additional code will slow it down. (I didn't make a note how long the loop instruction takes.)

Hi,
Have you googled.

arduino signal generator

Tom... :slight_smile: