Asteroids on Oscilloscope

The Joy of Tech - Anything and everything about all things shiny..
Post Reply
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Re: Asteroids on Oscilloscope

Post by adam »

hmm..actually seems this may only work with older boards with an ftdi chip: http://reprap.org/wiki/Burning_the_Sang ... ino_as_ISP

not sure - you can burn standalone chips that already have the bootloader - these are about £4 , programming blank chips seems less easy than i thought, though with older uno's available on dx.com for instance it might be easier

edit... have a look at this, see if you can decipher it:
http://www.open-electronics.org/arduino ... -circuits/
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

I'm making headway on the audio synthesis side of the gizmo gadget.

I had a bit of a conundrum where I thought I would have to build a really complex audio stage out of discrete transistors, and I found myself wishing there were braindead simple low voltage loudspeaker-drive-capable amplifier chips for audio applications. And of course, there are. And they were right next to the other stuff in the shop I was looking at, and they're about 30p each. Soblem prolved.

Probably looking at a TBA820M audio power drive amp chip system. Whack that on the side of my chip, use some lousy GPIO magic to output some waveforms and I've got my polyphonic PSG + loudspeaker.
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Re: Asteroids on Oscilloscope

Post by adam »

my clone arrived - they've cloned it so well that it says "made in italy" on the back, but came to me from hong kong, at a third the price of a genuine one - seems to work though, the led blinks and everything, will need some more bits now, i was thinking about digital pots as a cheap analogue out, though not sure they'd do audio rate waveforms, might do though
User avatar
venusian
Baaaaaaa!
Baaaaaaa!
Posts: 6653
Joined: Wed Nov 06, 2002 2:22 pm 0
Location: South Gloucestershire

Re: Asteroids on Oscilloscope

Post by venusian »

PWM through a transistor/FET is surely the easiest option?
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Re: Asteroids on Oscilloscope

Post by adam »

for waveforms it sounds like that's easiest - i've been wanting to output continuous
values too, so one from 5v/1-127 (or 127-1) for instance at a time, seems like the digi pot might be better for that - in the sense that it'd be putting a definite voltage out rather than a pulse train
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Re: Asteroids on Oscilloscope

Post by adam »

more about using-arduino-uno-as-isp http://codeandlife.com/2012/03/21/using ... no-as-isp/
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

adam wrote:my clone arrived - they've cloned it so well that it says "made in italy" on the back, but came to me from hong kong, at a third the price of a genuine one - seems to work though, the led blinks and everything, will need some more bits now, i was thinking about digital pots as a cheap analogue out, though not sure they'd do audio rate waveforms, might do though
I hate PWM. I hate the concept of it, and I hate the implementation of it. It is among the worst of all things. Good luck. :)

I tried driving my oscilloscope screen stuff through PWM at first, not happening. Getting audio-rate stuff out of an Arduino Uno's PWM would be incredibly lucky. You wouldn't have a lot of range on it, and it wouldn't be very nice.

If all you have is a bunch of GPIO pins and you want some proper analogue out, build an R-2R ladder across however many bits of output resolution you want. I did that to make a realtime polyphonic software synthesizer. Manually adding up all the channels and advancing the envelopes every sample used up 100% of the Arduinos computrons (adding timing commands slowed it down, there was not one spare cycle), but it worked at around 8khz.
User avatar
gumboot
Baaaaaaa!
Baaaaaaa!
Posts: 7652
Joined: Sun Aug 26, 2007 3:42 am 0
Location: trumpstain!

Re: Asteroids on Oscilloscope

Post by gumboot »

How about sigma-delta, then?
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Re: Asteroids on Oscilloscope

Post by adam »

Kamineko wrote: If all you have is a bunch of GPIO pins and you want some proper analogue out, build an R-2R ladder across however many bits of output resolution you want. I did that to make a realtime polyphonic software synthesizer. Manually adding up all the channels and advancing the envelopes every sample used up 100% of the Arduinos computrons (adding timing commands slowed it down, there was not one spare cycle), but it worked at around 8khz.
that sounds impressive - i think a friend of mine used an an r2r ladder initially for something then switched to a dac ic for improved sound quality, though if yours is a chiptune thing you might want lo-fi
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

Lo-fi is cool, except when you want to have high-pitched notes (well, middle C pitched notes) and you get horrible aliasing. :)

Writing a softsynth on Arduino is just a curiosity unless it's greased asm. (I don't know if "Arduino" (the system, as opposed to the sum of its components) has a teeny kernel to help with interfacing. If it does, you could ditch anything like that and write directly to the ATmel guts and get double the usable computrons and sample rate out of it at a guess.)

I have a MSP430 I'm not doing anything with right now, I could use it as a standalone sound chip if I designed a tiny interface to it that was along the lines of:
- select sound hardware (clock)
- select command 'play music'/'play sound' (music is low, sound is high)
- select program number (low is play music track/sfx 1, high is play music track/sfx 2)

And make the msp430 wait for messages on its bus, and then start doing the thing you tell it to on its clock high. The playback and mixing and output would all be in the MSP.

But THEN if I'm being that sophisticated, I can probably buy a PSG chip for 30p (or find a manky old console to gut) and wire it up (and level converter to interface it... shift register to convert MCU GPIO two wire stingy serial bit bang into a compatible parallel splat on the PSG) and have really nice audio instead.
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

Look what the postie just delivered...

Image
I still don't know why they were so kind, but I'll do my best not to let them down.

Now then, to the battle plan:
Image
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

Posting the text in a new post so people don't get a headache sliding the screen back and forth. :3

* 'Sense bus' in the top left. Basically like a 9pin atari style joystick port: pullups in the chip, you connect pins to ground on a button press to drag them low. And, like a 9pin atari style joystick port, it's programmable on the chip side so it could be used to trigger the Mega Drive pad multiplexer and so on (its 74HC157 multiplexer has super low current, works off the same supply, should be good to go). Can't do analogue, so no Amiga light pen support for you. If you were willing to write the quadrature stuff, you could use an Amiga mouse though. (A trackball maybe?) (Ha, I tell a lie: this thing's got analogue input on most pins, especially those in the top left. I could use an analogue stick!)

* Vdeo oscilloscope DAC output in the top right. No processing needed here, just outputs whatever the chip outputs. Gotta calibrate the display on the scope side to get the right offset and scale. I'm reluctant to use the output pins near here for anything else because I don't want the output messing up. I was going to put just pin headers on the end and use the probe clips to attach the scope, but I could use RCA sockets and get some RCA to BNC leads (the twisty locking connectors on the scope) for maximum goodness in connection. Wouldn't be a terrible idea to put 100R / 1k resistors in series here to prevent 'accidents' I think.

* Audio output in the bottom right. Four GPIOs connected through a safely resisty voltage summing junction to the amp stage, where a TBA820M does the amping and driving for the loudspeaker all in one, with its entourage of filtering caps and gain setting caps all smooshed in next to it. The speaker leads will probably be clipped or soldered onto the side of the board.

I've got five pins in the lower left that aren't doing anything. I was thinking of using one of these as a signal to control the flashing of the arcade buttons (using transistors as switches, GPIO output signal through resistor into base of NPN?).

There's a couple of pins between the video and audio outputs, but I probably shouldn't touch those. If I had to, I could chop up the board rail for the scope output and put the pin header close to the MCU, or solder in cables leading to phono sockets mounted on the case. That would make me feel better about bringing signals out from the pins beside the DAC outs, and let me use that big mostly unused rectangular board space to the upper right.

Speaking of space, if I'm running out of space by having the resistors, switches and LED for power on the left, and 'complex stuff' for audio on the right, I -could- just put audio on the left or power stuff on the right. That way the sense bus could be super short and I'd have tons of space on the right for getting the amplifier built right.

Right now it's arranged so 'input stuff' is on the left and 'output stuff' is on the right. If I change it so that the sense bus and video output (The DAC pins are top right fixed) are both on the right side, that side would be completely functionally useful at the same time as being short. The problem would be that there would be switchy voltage spikes happening right next to the DAC... also, there's a 'logic capacitor' on the middle right that absorbs spikes coming from the CPU as it decodes instructions. I probably don't want to be re-using that particular ground connection for the sense bus' button mashing ground. (So I break the rail there and have a 'clean ground' that goes right to the battery pack for the logic capacitor... right next to a 'messy ground' connected from elsewhere on the board for the sense bus?)

One advantage of having the 'sense bus' on the left is that there's a pair of programming pins in the upper left too. Having them exposed on a pin header would make connecting the programmer simpler (unless I buy a standalone programmer which I really should) and I could reprogram the chip while it was mounted in the board. (That said, the MCU actually has three pairs of programming pins, all having the same function just in different places to make the board designers life easier. The alternative programming chips are the lowermost pair, and the two between the DAC output and the logic capacitor on the right (directly above the logic capacitor).)

I'd like to know if I'm being paranoid about signal and power interference here. I could make the design a lot simpler if I allowed myself to assume 'ground is ground is ground' and 'supply is supply is supply' so I could re-use the Vdd Vss rails the MCU wants to directly power my other stuff.
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

I've got five pins in the lower left that aren't doing anything. I was thinking of using one of these as a signal to control the flashing of the arcade buttons (using transistors as switches, GPIO output signal through resistor into base of NPN?).
Or perhaps an input into a "X channel lamp driver chip TM" come to think of it.
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

I've decided that the amp stage is too useful to be soldered onto the main motherboard. It's not going to change after I've made it and I'm just following instructions anyway. I'm going to make it a detachable daughterboard instead. If I change this around so that I'm using a PSG at some point, the amp stage is going to stay more or less the same.

So... I'm building a standalone battery powered speaker then I guess? Cool.
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Re: Asteroids on Oscilloscope

Post by adam »

reusable, sounds sensible :)
Post Reply