Sunday, April 15, 2018

Bluetooth Speaker

  Began making a "bluetooth speaker". Using a BT receiver I found that comes with left & right RCA outputs and an 1/8 inch stereo jack for audio out as well as USB-B micro and USB-A jacks, too. It worked well with the Grundig.
  Wired out the BT pairing (red) and status (blue) LEDs as well as the main pushbutton, which serves as power and as a means of initializing pairing and re-establishing a BT connection, for relocation on the speaker's front panel.
  I'm going to build an amplifier for it using the LM4871 (*2) which is designed for 5V applications. Not certain whether I'll have a panel-mounted pot because I won't know how much actual gain it has, how much control I'll need, till I build it. I am satisfied that the concept is sound, based on my test using my Archer amplifier.

  Built up one experimental channel of the LM4871 amp on the old breadboard.

  Decent volume with 20kΩ R_fdbk, but better with 33kΩ. No "0.39µF" for that input cap, but there's a range given for that (0µ1 to 0µ47) - so I used two 0µ1 in parallel [0µ2].
  I didn't bother with the 'Shutdown' pull up, just tying pin 1 to GND.

  Knocked out the speaker panel. Soft maple is a lot harder than soft pine. I don't have a scrolling saw or anything like that, and my single-speed jigsaw is only for super-hack, so I drilled holes around the speaker hole borders. Plan A was to remove the rest with a chisel, but chiseling with the grain wasn't working out so great and across it may as well have been rock (too much work). Plan B was rasping out the rest to fit. Cannot complete the job till the grille fabric, held up in post, is delivered. (It was "mis-sent", that's official USPS lingo, to another post office and has languished several days there already.)
  There was a little chip-out, but a bit of grille cloth can hide a multitude of sins - assuming it ever gets here.

  Went with a sort of cross between "dead bug" and "manhattan" methods by cutting out 'islands' (instead of gluing down isolated pieces).
  I didn't order any components, drawing strictly from accumulated inventory.

  Amplifier test 100% success, no "issues".
  Continuing with the speaker panel, I glued some grille fabric but it has some sag; not terrible but anyway. Using some 'modern' synthetic fabric, black, which needs to be stretched out, somehow, but I couldn't think of a way to do that. Maybe there's a method on the web somewhere ("instructables"?).
  Still haven't tested it all powered from the intended, 2-outlet USB "cube," - been running the BT-RX from that, with the amp from a separate linear power supply.
  I found some brass fender washers to use as bezels around the front panel knob holes. I found some inserts coarse threaded external with machine thread internal, but decided to fix the speakers to the panel just using wood screws. The 'inserts' were a total pain in the hole.

  Completed the mounting of the speaker panel.

  Cut, drilled and screwed in two struts. Gluing the struts would have been easier but made any removal destructive. I haven't altered the cabinet, I've really wanted to avoid anything like that - though I had to bore ever so slightly the 4 existing holes for the dial bezel for the LED/LCD bezel. I thought that I had 8 screws, but I only had 6, so I used hot-melt on the brackets between the struts and the panel.

  Full USB Power success, both with the "cube" and the 5V rechargeable. I made a USB_A cable for Amp Power that plugs into the USB_A receptacle on the BT-RX ─ so only one full USB cable is needed (a USB_A to USB_Bmicro). Having the 5V rechargeable option makes it completely "wireless".
  The sound is great, even better than I had anticipated.
  I need to place the BT-RX and the amp board on a panel and commit to some finalized wiring. Everything is loose and alligator clips, rigged temporary.

  Also key are mounting the Status LED and pushbutton to the cabinet front panel.

Monday, January 15, 2018

Grundig - RTV 320 U

  Picked up this tuner-amp (c. 1968). I was drawn to its having a shortwave band.
  Blew it out, cleaned it up a little; it's basically functional.
  The previous owner tried rigging in an RCA jack scheme to circumvent the euro speaker connectors and it had no dial lights.
  The back panel serves as in "interlock" of sorts. I removed the AC cord, drilling out the rivets. I may take a shot at fabricating a replacement back panel (from fiberboard).
  I found an ebay seller with the euro connectors and another with a DIN-to-RCA cable. The Phono and Tape inputs are via DIN jacks.
  I replaced the dial lights. I must have been the first person to have done that. That's probably because the knobs have to be pulled and the dial plate removed to do that (a total PITA for dial lights). The bases were frozen in their sockets. Of note, they have their own transformer secondary.
  The left and right audio power amps are powered from separate secondaries of their own.
  The AM and SW switches have an issue, I have to tap them to get a circuit engaged. I should go back in, those contacts may benefit from some DeoxIT in/on the contacts. [see Follow Up]

  Tuning between FM stations results some noise like what you get from a noisy volume pot. Haven't encountered that. [Note: This is likely from an absence of 'FM Muting'.]
The volume pot itself is not noisy - which is surprising. Neither Treble nor Bass pot exhibit any noise and Balance is clean, too.

"Auf Bayern, mit Liebe"

  Follow-Up: Took the chassis out and sprayed some DeoxIT into the AM and SW select switches and it seems to good effect. They're sort of open at the back: spray and work 'em, wait, work 'em again, and repeat.
  The back panel calls out "7V" lamps and, given my 6.3V #40's, I was bugged about the line measuring 6.8v(ac) - so I put a couple of diodes back-to-back in series, knocking that down to '6v'. [The two dial lamps and the one behind the tuning meter are in parallel.]
  [Hadn't looked at the circuit board first time around, but noted that the screws securing it to the chassis were soldered over.]
  I was considering putting this in the front room as my 'daily driver', but it doesn't have a tape monitor loop.
  SW tuning requires extra patience because it doesn't have a fine tuning control. Lamentably, there's not much on shortwave to tune in anymore.

  11FEB2018 - Good results with a couple of Bluetooth receiver configurations, connected with DIN to RCA adapter found on (where else?) ebay.

Saturday, October 7, 2017

USB-6008 National Instruments DAQ

Chances are, if you're working with LabView then you have their USB-6008 DAQ. It's an I/O module. Its digital outputs are configured as "open drain".  That's not uncommitted open drain, though - they're tied high, each via 4.7kΩ to its 5V. Not good for much at that rate and their "knowledge base" reveals a certain lack of electronics comprehension among users.
NI's suggested "fix ya" is a pull-up, but that doesn't hit it for the "ON = 5V" people or those who need capability greater than its paltry own unassisted. They may have reasons for doing this (keeping the electronically uneducated out of big trouble), but, clearly, the device is certainly limited.

There are better solutions, and this is mine: a high-side driver. It requires two components, a resistor and a PNP transistor.
All with the example build atop the 6008, the circuit diagram is shown beside the module in the following picture:

I used a 2N3906 because its rated collector current is 200mA and it's commonly available. The 750Ω value isn't super-critical (510Ω - 1kΩ will do).
It should be noted that users have to check the "Invert Line" box in the Config tab.
You don't have to limit yourself to the USB 200mA, get an external supply you have the power.

Thursday, September 28, 2017


2017 SEP 24

I bought several VFD tubes (NOS) from an ebay seller (look for old_guy_radiola).

With a datasheet from a similar tube RadioShack once sold, many aeons ago, and a pin diagram for this device that I found on another webpage, I began experimenting almost immediately.

This is the 'final' demo circuit.
The segment anodes are pulled up, externally, with 10K resistors. Each '2003 output shunts the segment anode to which it's connected. CG is the control grid, it's a display enable for mux'ing.
[ i.e. logic input HI → output LO (to Gnd.) → segment Off ]
The filament runs on 1.5V

Basically a static demo at this point.
I will work out an Arduino sketch, for the Update, that will run the numbers (DEC and HEX), do BIN with the horizontal segments and a chase routine. (segment_a, _b, _c, _d, _e, _f, _a, _b,...)

The "A" looks odd because of the segment geometries were likely optimized for presenting numerals (there is a Segment h, a little nub for a more pleasing "4"). Segment c is kind of long. I will see how an "a" looks in comparison.
2017SEP30 - Update
I made the demo (as promised, but less the HEX part, too lazy)

Sunday, July 12, 2015

Exploring Esplora

I bought an Arduino Esplora at Radio Shack when our local was having its "fire sale".
It's a strange critter. I guess it's intended for people who wanted to experience the deal but are intimidated by working with electronics even to the slightest degree.
It has onboard pushbutton switches, a joystick, an accelerometer, a little speaker, a photocell, and an RBG LED (probably some other stuff I'm forgetting.)
Those things are all accessed with special Esplora commands.

It can be used, as a Leonardo, to send keyboard codes (use the Keyboard.x commands.)

There are 9 digital I/Os available on 3 headers: 2 on two different 3pin headers (orange) and 7 on the 10pin LCD SIP. 2 Analog inputs are available on two other 2pin headers (white).
The analog inputs are accessed via an onboard multiplexer which is completely different from the "analogRead" ADC of the familiar Uno (Duemilanove, &c.) paradigm.  The digital pins, though, are configurable as inputs/outputs in the pinMode / digitalRead / digitalWrite scheme.

I have found that the digital pins work with Servo.hThere is no "native" analogWrite capability, but it may be possible to use PWM.h for "analog output".  I haven't tried the SoftwareSerial library, but it may work, too.

More later.

Bought a couple of TFTs on ebay, designed to fit the Esplora headers. $10, not too bad. I think the alignment is off 1 pixel or something, you can see the bright line there on the right and the bottom.
Current draw: 60mA.

  • Softwareserial.h is Esplora compatible.
  • Also, the Esplora ADC reference is very supply dependent, it is == supply voltage. As V_usb varies from PC to PC, so too will ADC results.
  • The L LED is accessible as Pin 13. Make its pinMode an OUTPUT and then it's digitalWrite(13,HIGH); or digitalWrite(13,LOW);. It may be possible to hack it into another Digital pin by removing remove the LED. None of the left TFT header's pins gets used, so it could be jumpered over there. (Removing the LED may not be strictly necessary.)
The "Tinkerkit" outputs, at least, are supposed to be compatible with analogWrite. I am sure they are, but with my little experiment today, I can confirm that "D11" definitely is, with a period of 1.04msec (960Hz).
I am lazy and didn't write my sketch to check "D3" (maybe it's a different freq/timer used?). I will update when I have more info.
More experimenting, less about the Esplora and more about the motor circuit. Added motor capacitor to improve the Collector voltage condition in the Off state. The same goes if using a MOSFET (the Drain voltage condition in the Off state.) Go over to H-Bridge & Motors page for more info.
The sketch includes a brief 2.2kHz (50%) interval. You'll see that in the scope trace and the Esplora blue LED goes On.

The Adafruit Neopixel library is compatible with Esplora.
My experiment used D11.

Adding the following links (resources) ─

Leonardo library is useful too.


   Been checking out the microphone (readMicrophone); it's LM358-based amplifier is pretty low-gain ("50").  My experiment was: change an RGB output when a threshold waiss crossed, the threshold set by the Slider. The Slider had to be kept near the low end.
  Changed resistor values for more gain and usable range vs. ADC. (New values for R1 and R5 in bright red.) The gain is now "221", (220k/1k) + 1.

   Confirming that the RGB LED elements can be set outside the Esplora library (writeRed, and so on) using digitalWrite and analogWrite. Green is D10, Blue is D9, and Red is D5.
  If you need more outputs and you're handy with a soldering iron, you could remove the RGB LED, which is a 'common cathode' device. There are 1k resistors between the microprocessor pins and the RGB pads. Those resistors are part of a surface mount pack, very fine pitch.
  They should be configurable as input pins too, though I haven't tried this.

  OK with WS2801.
  I soldered up a custom interface panel and got Esplora, the LED strip and the power supply interconnected with some crimp caps and a few hacked jumper assemblies. The space between the "tinkerkit" connectors is 0.2in, so a 7 pin header can span the two of them. 2 outputs pins are required to operate the WS2801.

Sunday, July 6, 2014

Graphics LCD [GLCD]

I have some 128x64 Graphics LCDs that have been "sitting in inventory" for a long time. Probably got them from (they're AZDisplay AGM1264). They're KS0108-based, nothin but pixel control; there's no character set, the designer has to create all that himself.
A week or so ago I took one out and really started researching. I found a good site ( that was very helpful, especially with his simulator.

I wanted to write my own code (not pinch someone's "library"), that's how I roll. All credit to me (Hurrah!)

  • I found that the Enable (E) pin is actually a data latch.
  • The display comes up with all of the pixels dark (on), so they have to be cleared out.
  • There's a parameter that cannot be overlooked: Display Start Line, it's an Instruction. It doesn't default to zero and can be unpredictable that way. I wasn't doing anything with it and the display would come up with the top line of pixels dark (on). I thought that it was possibly a defective unit, but I remembered seeing an opaque note in the datasheet note about its use for scrolling, so I thought that I'd better get in there and plug something in - and that made my problem go away.
  • Its Vee is NOT an input for an external negative supply, it's the output of an on-board negative supply that gets wired to a contrast pot.  Unlike a lot of character LCDs (44780-based designs), you cannot get by with connecting Vo to Gnd.

So far I'm just using the left half to figure things out, less to manage.

The results (so far):

The same message, twice, but the second has "reverse field" characters.
Well, that's all for now.  I'll post back soon with more info, pics, and so on.

2015FEB20 - Kind of getting back into this.  Here's a pic of the pin out.

Friday, November 23, 2012

AC Phase Control - TRIACs

I've made an AC Dimmer circuit using a TRIAC to experiment with AC Phase Control.
It uses an Arduino to control the TRIAC gate firing.

The situation here is: 120 vac, 60Hz.
This is an application of what's known as "random fire" (or random-firing) technique for full phase control. The term random is kind of misleading. Dimming cannot be effected by triggering the gate indiscriminately; triggering (firing) must be done synchronized with the line frequency. The line frequency is detected by finding the zero-cross, the point where the line voltage is at or near zero, which occurs with each alternation (half-cycle).
The resistor on U1's input (between AC Line and U1 pin_1) is 18.6 kΩ.  I used 3 6.2 kΩ (1W) resistors in series.  [The value wasn't specified on the schematic, prompting my doing so here.]
The Arduino gets zero-crossing pulses from U1's output at D2, one of its hardware interrupt pins.
The delay angle is selectable via two DIP switches. The default is 1 msec and the DIPs are binary weighted [i.e. delay time = 1msec + 1, 2, or 3 msec more.] With that, the conduction angle can be set to approximately 158, 135, 112, or 90 degrees.
Obviously, more resolution could be had with more switches, that's academic enough, but my objective was not some high degree of (or seemingly continuous) variability. This is a research project and these few well-defined options are sufficient.

The zero-cross signal is awaited, its occurrence initiates the Interrupt whereupon the DIPs are read and thereby the delay time determined, then shortly the Gate signal pulses after the appropriate delay time and the process repeats.
As there's a snubber across the TRIAC and a snubber for the gate, too, I do intend to try it all out with a fan. That's my plan. But I confess that I'm squishy on it right now - preferring to bask in the glow of my present success before plunging into a power factor situation.
Before that, though, I want to take some pictures of the TRIAC output on the scope.

//     ***  Triac_03  ***
//  It's Working!  17 NOV 2012
//  gateEnable output lags
//  Triac_cue [zc] by 1-4 msec
//  via DIPSW1,2

byte gateEnable = 3;     // alias output
byte DIPSW1 = 4;         // alias input
byte DIPSW2 = 5;         // alias input
byte GatePulseTime = 1;  // at or near Alt start
int timesel;
volatile boolean zeroCrossed = false;  // flag

void setup()
  pinMode(DIPSW1, INPUT);
  pinMode(DIPSW2, INPUT);
  pinMode(gateEnable, OUTPUT);
  attachInterrupt(0,Triac_cue,RISING); // Ext_Int on D2

void loop ()
  if (zeroCrossed == true)

// ----- The Interrupt -----
void Triac_cue ()
{zeroCrossed = true;  } //

void triacTrigger ()
  delay (GatePulseTime);
  digitalWrite(gateEnable, HIGH);  
  delay (1);
  digitalWrite(gateEnable, LOW);
  zeroCrossed = false;  // flag reset

void DIPread ()
  GatePulseTime = 1;
  timesel = digitalRead(DIPSW1);
  if (timesel == HIGH)
  {GatePulseTime = GatePulseTime + 1;}
  timesel = digitalRead(DIPSW2);
  if (timesel == HIGH)
  {GatePulseTime = GatePulseTime + 2;}

I have been using "TRIAC", my preference. Should I use Triac when it's the first word of a sentence and triac otherwise? A textbook of mine, "Industrial Solid-State Electronics", uses the latter word form.

26 NOV 2012  The results with a 40W lamp are really good, but managing a string of LED holiday lights leaves much to be desired.  At 90deg, they were practically off.  I'm speculating, but I think that the LEDs, being a low-current affair, can't make the TRIAC's holding current and end up dropping out prematurely.
26 NOV 2012 (Pt. 2) I ran the LED holiday light string along with a 40W lamp and had much better results.  So, it's the holding current - the LEDlights don't draw enough (not one string, nor two.)
27 NOV 2012  So, here's the last on the LED holiday lights.  It came to me that I didn't need to use a TRIAC at all. Given the low current of these LEDlights, the triac driver (MOC3023) itself is sufficient. The zero-cross reference is still required and the MOC's logic input has to be kept active for the entire time of the conduction angle.

Here's the schematic of the modification.

This is the test "sketch", it's very coarse, just enough to prove the point. If you need gradual, put more work into it.
N.B. It doesn't use the switches, that part of the original circuit is not needed.  It loops through some chosen values, dwelling at each, and repeating the cycle.
[None of the sketches listed or referred to from hereon have need of the DIPswitch circuit.]

byte gateEnable = 3;     // alias output
byte GatePulseTime = 1;  // delay time till start
                         // 1 = brightest
byte PW = 0;             // conduction angle
int index = 0;
volatile boolean zeroCrossed = false;  // Interrupt Note

void setup()

  pinMode(gateEnable, OUTPUT);
  attachInterrupt(0,Triac_cue,RISING); // Ext_Int on D2

// ***** ***** ***** ***** //

void loop ()
  if (zeroCrossed == true)
// ***** ***** ***** *****

// ----- The Interrupt -----

void Triac_cue ()
{zeroCrossed = true;}   // !!!
// ---- ---- ---- ---- -----
// ---- ---- ---- ---- -----
void triacTrigger ()
  delay (GatePulseTime);
  digitalWrite(gateEnable, HIGH);   
  delay (PW);
  digitalWrite(gateEnable, LOW);
  zeroCrossed = false;  // Reset
  index ++;
  if (index > 720)
  {index = 0;}
// ---- ---- ---- ---- 

void fade ()      // GatePulseTime + PW must total 8 (8msec)

  if (index < 120)
    GatePulseTime = 1;
    PW = 7;
  else if ((index >= 120) && (index < 240))
    GatePulseTime = 2;
    PW = 6;
  else if ((index >= 240) && (index < 360))
    GatePulseTime = 3;
    PW = 5;
  else if ((index >= 360) && (index < 480))
    GatePulseTime = 4;
    PW = 4;
  else if ((index >= 480) && (index < 600))
    GatePulseTime = 5;
    PW = 3;
    GatePulseTime = 6;
    PW = 2;
30NOV2012 Still sidetracked on this holiday LEDlight fading. 
I knocked out a better "sketch", the fading levels go up/down

byte MOC_logic = 3;  // alias output
byte Intensity;      // conduction angle
byte startPosition;  // delay time till start
int index = 0;
volatile boolean zeroCrossed = false;  // Flag

void setup()
  pinMode(MOC_logic, OUTPUT);
  attachInterrupt(0,cueStart,RISING); // Ext_Int on D2

// ***** ***** ***** ***** //
void loop ()
  if (zeroCrossed == true)
// ***** ***** ***** ***** //

// ----- The Interrupt -----
void cueStart ()
{zeroCrossed = true;}   //  !!!
// ---- ---- ---- ---- -----
// ---- ---- ---- ---- -----
void enableOutput ()
  startPosition = (8 - Intensity); // "delay angle"
  delay (startPosition);
  digitalWrite(MOC_logic, HIGH);   
  delay (Intensity);               // "conduction angle"
  digitalWrite(MOC_logic, LOW);
  zeroCrossed = false;  // Reset
  index ++;
  if (index > 240)
  {index = 0;}
// ---- ---- ---- ---- 
void fade ()
  // not a lot of difference between
  // Intensity = 6 and Intensity = 7
  if (index < 30)
  {Intensity = 6;}
  else if ((index >= 30) && (index < 60))
  {Intensity = 5;}    
  else if ((index >= 60) && (index < 90))
  {Intensity = 4;}  
  else if ((index >= 90) && (index < 120))
  {Intensity = 3;}
  else if ((index >= 120) && (index < 150))
  {Intensity = 2;}
  // Intensity = 1 is very low
  // fade up   
  else if ((index >= 150) && (index < 180))
  {Intensity = 3;}  
  else if ((index >= 180) && (index < 210))
  {Intensity = 4;}
  {Intensity = 5;}

Here's a solid demo, there are scope traces in addition to lights
Here's a scope trace - for good measure (Ha!)

30 NOV 2012 (Pt. 2)  I hooked the TRIAC circuit up again and used it with the immediately previous "sketch" and it works!
I think that this time I really will get out of the 'holiday lights' tweak.
30 NOV 2012 (Pt. 3) Crap! I have to walk that back some.
I had put the scope away, but I decided to bring it back out and have a look.  Despite improved fading over the way it was before, I saw on the scope that it was only conducting on one alternation, asymmetrical.  Then I plugged the 40W lamp in with it and it looked even better than the MOC3023 does.  It's totally textbook with the lamp plugged into it.
So, one "strand" isn't enough to do it with the TRIAC.  My strand takes 20ma.  My TRIAC (BCR8N) spec has both holding and trigger current of 100ma, which means a load of at least 12w. Looks like TRIACs with the lowest holding currents are also of the "sensitive gate" type.  There are many Standard types, 400V, 25ma - search Digikey.
I am using this particular Triac because I bought a few on a whim once.
[Maybe 5 strings would do it to it, but I don't have that many to confirm. A resistor might fix it, but it won't present the PTC characteristic (cold = low ohms, hot = high ohms), which it seems would be beneficial at low voltage, but maybe not essential, there has to be a substantial voltage present for the LED string to light up anyway.]
Still, no kidding, the MOC3023's aren't a bad way really are a good way to go for this application.
Good night.
01 DEC 2012  Here's a demo of a TRIAC output, the classic wave-forms you expect to see (running from the same sketch above)
You see that the TRIAC switches off better than the SBS output of the MOC3023 (it's depicted in the data sheet with a TRIAC-like symbol, instead of the SBS symbol, but it is a light-activated SBS.)
Be that as it may, the circuit the TRIAC is controlling needs to be drawing appreciable current or the TRIAC is unhappy. Maybe I should have demo'd that part, too?
* Here I can add, and do confirm, that the TRIAC output is just as solid by pulsing the Gate, at the beginning of the conduction angle - the method used with the very first "sketch" up at the top (it's labelled "Triac 03".)

I made a lot of assumptions about Triacs, I took a lot for granted, but I now have an appreciation for trigger current and holding current, at least I think I have a lot better handle on that than before.  Hadn't ever designed with them, they were always a "working or not working" proposition.  I certainly had the lamp dimmer going good, then I got sidetracked on the 'holiday LED lights' and got educated almost by accident.

I need to get back to my plan - running the fan. I was reading an app-note from ST and from what I gather, given an inductive load, the Gate should not be pulsed, but held on (given "ELI".)

09 DEC 2012  I still haven't run the fan. But I was making some H11/3023 boards and I used 2K resistors instead of 1K on the 3023 logic/input - and that skrewed it up. I swapped those out with some 470Ω that were on my bench and that brought things right (same as before.) That light-activated SBS is light-dependent for sure, it's like CTR with a photo-transistor output.

22 DEC 2014  Two years later! (Hard to believe.)
I have some VO2223 "power photo-triacs" to try out. I plan to mess around with those this weekend.
I've had the light-string up at work and I developed a new "sketch" - it has two routines for fade up/down (two speeds) and two routines for blinking (fast, slow).
Look for lightstring03 in my Where's The Code? page.

04 JAN 2015  OK, I finally got a VO2223 circuit together. I found out that they need more input current. With a 40w bulb I was only getting 60v when on with 4-5ma input. Running that up to 10ma got me over that hurdle. I need to incorporate this with a zero-cross board of its own.

All constructive Comments are encouraged (and encouraging)!