Asteroids on Oscilloscope

The Joy of Tech - Anything and everything about all things shiny..
Post Reply
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 had a look at the datasheet for the LM386 power amp, and felt a bit of a wally for not trying it earlier. It's designed to work without many external components. I could pretty much put it on the board and that would be it. All that time drawing out TBA820M amp daughterboards... wasted!

And then I read that the LM386 is designed for a 4V minimum supply, my dsPIC works within 3V - 3.6V, and the TBA820M works on 3V+, and I'm buggered if I'm having multiple supplies or whatever. And all was right with the world.

Edit - Aw darn it. I'm such an electronics noob. Even simple stuff like designing a low battery indicator LED circuit is making my head spin.
adam
Baaaaaa!
Baaaaaa!
Posts: 4418
Joined: Sat Jun 24, 2006 9:15 pm 0

Re: Asteroids on Oscilloscope

Post by adam »

a pair of regulators would do it - one 5v and one 3-3.3v, you could power it from a 9v supply - or just a stable 5v supply with a 3.3 regulator (a pi supply for instance)
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

Regulators are a good idea in any case, but I'm soooo lazy.
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

Hey Kamineko. Idea:
Design circuit to run from 3.3V voltage regulator attached to foobarV battery pack.
Use voltage divider to supply fraction of raw voltage to dsPIC33F's analogue input pins.
Use dsPIC33F to sample the scaled input voltage and signal the battery low LED on condition foobarV < badV.
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

Unpredictable sampled analogue voltage measurements are an entropy source... :o
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 have a programmer!
Image

Fiddly as all hell and doesn't work immediately out of the box in Linux (the sample projects use the wrong case for the include filenames)! All is as it should be.

And if I'm canny, I may have a case. I SHOULD be able to cram in the mainboard, audioboard, speaker, batteries all in there. Drill out a space for the D connector, switches and LEDs. At the very least, I definitely have biscuits. :)
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

If you'd like to play along at home, here's the parts list.
(Also a reminder to myself for what all the parts I ordered are for.)

Code: Select all

Item Name                                               Quantity        Price   Total
  Tools:
TL003 - Stripboard Track Cutter                         1               £3.27   £3.27
  Mainboard:
HW005 - Stripboard 64 x 95mm                            1               £0.85   £0.85
BAT014 - AA x 3 Battery Holder                          1               £0.66   £0.66
CN022 - PP3 Battery Clip                                1               £0.16   £0.16
QD205 - 78L33 3.3V 100mA Voltage Regulator              1               £0.30   £0.30
  Power switch:
SW117 - DPST Budget Rocker 6A 250V                      1               £0.57   £0.57
  Reset switch and safety network:
SW096 - Red PTM Square Switch                           1               £0.41   £0.41
CR258K2 - 8K2 Carbon Film Resistor 0.25W 5%             1               £0.04   £0.04
CR25270R - 270R Carbon Film Resistor 0.25W 5%           1               £0.04   £0.04
EC0U163 - 0.1uF 63V Electrolytic Capacitor              1               £0.10   £0.10
  Power LEDs:
OP002 - Red LED std 5mm                                 1               £0.09   £0.09
OP003 - Green LED std 5mm                               1               £0.10   £0.10
CR25180R - 180R Carbon Film Resistor 0.25W 5%           2               £0.04   £0.08
CR25220R - 220R Carbon Film Resistor 0.25W 5%           2               £0.04   £0.08
  Power physical interface header:
CN156 - 8-Way Single Row Socket                         1               £0.32   £0.32
  MCU holder:
CN137 - 28-Pin DIL Socket PP 0.3                        2               £0.17   £0.34
  MCU extra caps:
LC10U50 - 10uF 50V Low ESR Electrolytic                 2               £0.08   £0.16
  Power measurement divider:
CR2522K - 22K Carbon Film Resistor 0.25W 5%             2               £0.04   £0.08
  Audio mixer divider network:
CR25180K - 180K Carbon Film Resistor 0.25W 5%           4               £0.04   £0.16
VR018 - 50K Carbon Horizontal Preset                    1               £0.12   £0.12
  Zipstick port:
CN042 - 9-way Solder Lug D-Plug                         1               £0.32   £0.32
CN182 - 10-Way Single Row Socket                        1               £0.32   £0.32
  Audio amp board:
HW017 - Stripboard 25 x 64mm                            1               £0.31   £0.31
QU255 - TBA820M 1.2W Amplifier                          1               £0.56   £0.56
EC4U740 - 4.7uF 40V Electrolytic Radial Capacitor       1               £0.07   £0.07
EC47U25 - 47uF 25V Electrolytic Radial Capacitor        1               £0.08   £0.08
EC220U25 - 220uF 25V Electrolytic Capacitor             1               £0.09   £0.09
EC100U25 - 100uF 25V Radial Electrolytic Capacitor      1               £0.07   £0.07
CC390P - 390pF Ceramic Disc Capacitor                   1               £0.07   £0.07
CC220N - 220nF Ceramic Disc Capacitor                   1               £0.07   £0.07
CR251R0 - 1R Carbon Film Resistor 0.25W 5%              1               £0.04   £0.04
CR2522R - 22R Carbon Film Resistor 0.25W 5%             1               £0.04   £0.04
VR031 - 200R Carbon Horizontal Preset                   1               £0.13   £0.13
  Audio knob (goes on interface):
VR010 - 10k log 24mm potentiometer                      1               £0.89   £0.89
KN002 - Potentiometer knob BLUE                         1               £0.33   £0.33
  Power caps for all!
LC220U16 - 220uF 16V Low ESR Electrolytic               6               £0.15   £0.90
CC100N - 100nF Ceramic Disc Capacitor                   6               £0.05   £0.30
  Video safety resistors:
CR25820R - 820R Carbon Film Resistor 0.25W 5%           4               £0.04   £0.16
  Video connector:
CN004 - Phono Socket panel mount RED                    1               £0.39   £0.39
CN136 - Phono Socket Yellow                             1               £0.39   £0.39
CN144 - 4-Way Single Row Socket                         1               £0.26   £0.26
  Connectors between audio board and mainboard, log pot physical interface and audio board:
CN153 - 3-Way Single Row Socket                         3               £0.23   £0.69
  Pin headers everywhere so it's dismantleable:
CN103 - Single Row Header Strip 36-way                  2               £0.29   £0.58
  I honestly don't remember what this is for:
CR2510R - 10R Carbon Film Resistor 0.25W 5%             1               £0.04   £0.04
        Subtotal        £15.03
Shipping is First Class Post    Shipping        £1.75
        Tax (Inc)       £2.80
        
Currency is British Pound       Total   £16.78

(Also add these because I forgot. Bitsbox lets you add items to a finalised order for a 25p fee. Phew.)
HW054 - Panel Clip 5mm LED                              3               £0.10   £0.30
HW062 - Velcro Strip 20mmx25cm                          1               £0.85   £0.85
That 10R resistor is a real mystery. I'm worried because if there's one component I don't know why I clicked on, it was probably part of a supporting system which I started to add the parts for but didn't finish. Try as I might, I couldn't figure out where in my notes that resistor appears.

If I'm missing stuff, I'll scrounge it from DoES next time I'm there. ;P
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

That was a nice surprise!

Image
Ordered them yesterday afternoon, they were waiting for me on my doorstep at 9am today.

Bitsbox.co.uk saves the day.

Everything is present and correct, all tested and good to go.

One thing I messed up on was the potentiometer volume knob. I underestimated the size of the shaft, so if I were to put it in as it is, I would have a big knob sticking out. I can easily fix it by sawing off some of the shaft though. I'll have to file it too so that the knob will fit on nicely.

Also, I didn't know whether I wanted a linear pot, a log pot or an inverselog pot. I was advised to get a log pot because it's for volume, so I did. But by my calculations I should have gotten an inverselog pot instead. If I install it as it is, the resistance will decrease slowly at first as you turn it clockwise and then rapidly at the end of the range. The curve is backwards so it'll get really loud really quick, and then barely change at the upper level.

Alternatively, I can easily fix the problem by reversing the connections and making it so you turn the knob anticlockwise to smoothly increase the volume. (I'd anticipated getting this wrong anyway. In my notes, the log pot connects to a three pin ribbon cable onto a pin header on the separate audio amp board. To change the L-M-R connections on the circuit, I just turn the ribbon 180 degrees.)

If a big shaft and a backwards knob are the worst things that happen in this project, I'm very thankful.
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

Late last night...

Image
Image

The amp board is in the bag! It's a standalone TBA820M board that should run off +3V to +12V and give speaker-driving-ish gain controlled by the trimmer in the corner. The circuit is taken unchanged from a sample schematic from an amplifier component review in Everyday Practical Electronics May 2002. (There is a PDF of this online.)

The two pinheaders on the left of the board let me detach the board and use it in other stuff. Putting this thing on a standalone board was 200% the correct idea. It would have sucked trying to repair this thing if it were built into the main board alongside the MCU. The topmost/leftmost 3 pin header is for +V supply/signal/ground. Just for this test, the power supply is tucked into electrically equivalent places on the board where the cables wouldn't come loose.

The pot knob is on the left, soldered to a 3 wire ribbon cable.

The biscuit tin is going to be like a PC case with all the interface wires on ribbons waiting to be plugged into pins on the main board.

Video.
A bit of a victorious moment courtesy of the Naruto soundtrack.*

I've gutted an audio jack lead and wrapped the cables around the appropriate pinheaders to quickly hack up some some sample audio input.

The audio quality is good! You can tell it's good, because the music is still recognisable after being played from a £3 MP3 player, through stripped cables loosely wrapped onto pin prongs, through a circuit I soldered together myself, into a salvaged speaker, recorded through a Kodak camera mic as a Quicktime MOV and then compressed and uploaded to Youtube!

The TBA820M is firing on all cylinders, any deficiencies are due to my lousy soldering, the use of three 5-year-old rechargeable batteries as the supply and the speaker which I gutted out from gawd knows what. (An old loudspeaker unit? Possibly an old electronic keyboard?)

(*shush, you. It's a useful song and it fit the mood of building something THAT WORKED. And the Youtube description isn't entirely accurate. It also plays Yellowcard songs.)
User avatar
gravy
Sheepie Whore
Sheepie Whore
Posts: 19572
Joined: Wed May 01, 2002 1:28 pm 0
Location: The Other Place

Re: Asteroids on Oscilloscope

Post by gravy »

User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

Ha! Every day is scopes day!

If using the sound output to supply the oscilloscope video wasn't a wobbly mess on my comp, I would have supplied the sound using the logical source: the VGA. ;)
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

Laser cut instrumentation panel.

Image
Image

There's no way this is going to fit nicely on the biscuit tin, so I either need to get a rectangular tin or laser cut the entire case... I kind like the idea of a wooden case!
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 »

Volume knob is aroused.
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

No two ways about it. It's a big knob.

It was listed as a 24mm pot in the shop but I found out later that refers to the length of the sweep. It'll have to be altered.
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: Asteroids on Oscilloscope

Post by Kamineko »

God fucking damn it.

When I bought a programmer, I thought I bought this one, but I in fact bought this one.

One of them supports all dsPIC33F devices. One of them supports only the two underpowered shitbags that come shipped with it. They REALLY shouldn't have put 'for dsPIC33f' on the box.

I suppose I could buy the other programmer, but it's WAY WAY WAY too much for me. I bet they're the same inside as well, the 1 and the 2.

I'm thoroughly annoyed. At myself, at everything. What a great big shitty disappointment. Electronics, man. It's a load of shit. Don't ever try it.
Post Reply