I want to be able to generate custom square waves where the duration of each high and low is controlled by my computer. (As I discuss below, 48kHz sampling is enough.) The tricky thing is I want to have several of these items and share them with others, so I need to keep them relatively inexpensive and quick to make. They have to run on batteries or power themselves off the computer connection.
My first thought was using the parallel port. Obvious problems being that parallel ports are disappearing so my friends might not have any, and I believe the computer has to be switched off to plug things in (though that might not apply here). Also, I have no idea how to do the precise timer control, or if it's even possible, since parallel ports weren't designed with that in mind.
I've already made something that works by transforming an audio signal. The advantage is that it's easy to make the wave files, and the sound card handles all the timer control for me.
The first problem is it's a very low voltage, and needs amplifying before the digital components can use it- and the op-amp seems to need to a +-6V power supply in order to work properly, which I don't like much due the above power supply restriction.
The second problem is the audio output won't hold a voltage for very long, so I had to set it up so an audio pulse would toggle the final output. If it ever misses an audio pulse, the final output ends up inverted until I correct it.
Basically this circuit is too big, and I don't think it's reliable. If I gave it to anyone else, I'm really not sure if it would work.
The best thing would be if there was some cheap USB device that would do it all. If there was demand for it, I'm sure there could be something of about the complexity and price of a cheap memory stick, but I've drawn a blank so far. There are plenty of USB signal generators, but they're all expensive things with hundreds of features. Nothing small and simple.
So, any ideas on the best way to do this? Have I missed anything obvious?
My first thought was using the parallel port. Obvious problems being that parallel ports are disappearing so my friends might not have any, and I believe the computer has to be switched off to plug things in (though that might not apply here). Also, I have no idea how to do the precise timer control, or if it's even possible, since parallel ports weren't designed with that in mind.
I've already made something that works by transforming an audio signal. The advantage is that it's easy to make the wave files, and the sound card handles all the timer control for me.
The first problem is it's a very low voltage, and needs amplifying before the digital components can use it- and the op-amp seems to need to a +-6V power supply in order to work properly, which I don't like much due the above power supply restriction.
The second problem is the audio output won't hold a voltage for very long, so I had to set it up so an audio pulse would toggle the final output. If it ever misses an audio pulse, the final output ends up inverted until I correct it.
Basically this circuit is too big, and I don't think it's reliable. If I gave it to anyone else, I'm really not sure if it would work.
The best thing would be if there was some cheap USB device that would do it all. If there was demand for it, I'm sure there could be something of about the complexity and price of a cheap memory stick, but I've drawn a blank so far. There are plenty of USB signal generators, but they're all expensive things with hundreds of features. Nothing small and simple.
So, any ideas on the best way to do this? Have I missed anything obvious?