Friday, June 5, 2015

Annoying Beeping Prank Circuit

Since i quit my old job last week, and I had the last day more or less alone in the office, I made a few loving pranks on my coworkers. One of them was a simple circuit based on a 555 timer. The circuit is simply a pulse oscillator with a couple of minutes between pulses. The circuit is seen here:
556 Pulse oscillator
The 1M Ohm resistor sets outputs high time together with the capacitor. The 100 Ohm resistor and capacitor sets the low time. This setup gives the inverse output of what I wanted to drive the buzzer (should be any buzzer with internal oscillator that can be driven by 9V), but it needed to be that way to keep power consumption low. If the resistors where swapped, the DIS-pin would discharge the power rail through the 100 Ohm resistor instead of the capacitor. To invert the output i used a second 555 as an inverter. In this configuration the circuit drew 8mA, which would give a couple of days use with a 9V, 580mAh battery.
Google told  me there was a CMOS-based low power version of the chip, TLC556. That chip was pin compatible and used up 0.3mA. This gave a run time of about 80 days which I was very happy with.
The circuit simply gave a short, loud beep every few minutes. I hid it in my colleagues flower pot and it took him quite a while to find it.. ;)
Implemented circuit

Sunday, April 12, 2015

MIDI2VC+, a MIDI driven Voltage Controller

The MIDI2VC+, v2, is finally finished. These are the implemented features:
MIDI2VC+, v2, primary side.

MIDI2VC+, v2, secondary side.

  • 5 octaves 1V/octave VC output
  • 3V gate output
  • Low note priority
  • Filters channel number, plays any MIDI-note regardless of channel
  • MIDI input and USB-MIDI input. Prioritise USB if both are connected.
  • Reset button
  • Pitch bend, 2 semitones in each direction
  • Input voltage 8-35V (high input voltage may need heat sink on regulators)
  • 5us trigger output
  • Powers USB-keyboard
  • USB interface tested on Korg MicroKEY 25
  • RCA jacks as outputs. Used RCA wires are easy to find very cheap, and jacks can easily be salvaged from scrapped audio equipment.
  • Both code and hardware is open source licensed to CERN OHL v.1.2.
The PCB needs two straps. The MIDI input to the micro controller has no connection. Pin 4 on the optocoupler needs to be strapped to pin 24 on the micro controller. Also, the optocoupler needs to be powered from the 3V3 rail instead of the 5V. Before the optocoupler is mounted, one needs to cut out pin 6 and the pad from the pull-up resistor right besides it. When the optocoupler is mounted, strap a wire from pin 6 to the 3V3 rail.

Cutout below optocoupler.
Anyone is welcome to edit the layout files to fix the straps. I'm not going to do another version of the PCB at the moment. Eagle files and source code is available here.



Monday, March 16, 2015

Tinker-Box รก la Bob Pease

I made a tinker-box, as recommended by Bob Pease in Troubleshooting Analog Circuits. It's simply a box of banana jacks connected to various resistors and capacitors. There is one rotary switch connected to resistors of values 10-66kOhms. There is a second rotary switch connected to capacitors of values 10p-1uF. Finally there is also a 100k potentiometer and a ferrite bead. Not much else to say about it other than that it's of great use when experimenting with op-amps. I used it when  i built last posts EMC-meter.
Inside of tinker-box.

Panel-side of tinker-box.

Saturday, March 14, 2015

EMC sound detector

I saw this youtube video a while ago. It shows an EMC meter using a piezoelectric summer, a coil and a fet.I thought that instead of  coil, I could do the same thing using a semi-rigid cable for a magnetic field probe, like the ones Doug Smith describes. I have previously written about a field probe that I have used with an oscilloscope. The signal from the probe that I have seen has been on the order of 10mV, max. This is far to low to make a summer sound. The summer needs a at least a few volts of signal to sound enough.
So to make this circuit work I needed to produce a gain of at least a few hundred. I started out trying to do this with an uA741. With a gain-bandwidth product of 1MHz, I could at most produce a gain of 100 at 10kHz, which was a bit weak. After that I tried using a . It had a better gain-bandwidth product of 3MHz, but I had a lot of problems with lock up and oscillations.
Finally I solved the gain-bandwidth issue using two op-amps, the LM358 (two amplifiers in one package).  Since the signal is low, and we are interested in the AC-signal, I AC-coupled the feedback loop in both amplifier stages. Final circuit looks like this:
EMC sound detector
EMC sound detector, actual build.

There was some trial and error and usage of what components was at hand. To determine the maximum gain of the second stage, I used a potentiometer where the 270 ohm resistor is now. I turned the potentiometer to just below the point where the circuit started to oscillate. The circuit is sensitive enough to sound out fields from, for example a cell phone, but the sound volume isn't that high. I think the circuit can achieve higher gain with a smaller cap on the output (22uF now). I would need to put a higher resistor after it though, to keep this stage from filtering out low, but audible frequencies.

Tuesday, March 10, 2015

New PCB's and Books

Got the new PCB's for the MIDI2VC+ v2 from OshPark yesterday. I'm pretty happy with how they look. I managed to cram in everything on the top layer. The bottom layer is only ground, not a single trace or component.
New PCB's from OshPark
Also, I got some nice books from dad for my birthday. It's:"Build your own transistor radios" by Ronald Quan and "Experimental methods in RF design" Wes Hayward et. al. These will most certainly give some nice ideas for electronics projects. I've already started reading Quan's book, and it's really interesting.
Some nice birthday books from dad

Sunday, March 1, 2015

Velleman KSR6 kit, error in silkscren

Last post I talked about the KSR6 Velleman kit and that the robot didn't turn when closing in on objects. After troubleshooting the robot for a while, I finally found the error. The voltage divided node at U4 +in and U3 -in lay at nearly 6 volts, instead of the expected 3 volts (which in retrospect is odd, this voltage should instead be closer to 2V, only explanation I can come up with is that that R8 had a bad connection, but who knows?). This made the integrator U3 integrate only voltages over the node, which was almost nothing... After inspecting the schematics and the layout, it was obvious that the silkscreen component markings had mixed up R8 and R10. Switching them made the robot work the expected way.
This might not be true for all PCB versions. This PCB was marked 21-885. If you are uncertain, measure the voltage of pin 3 or 13 of IC1. It should be  close to 3V. If resistors are placed wrong, voltage will be closer to 6V.

Monday, February 23, 2015

Velleman Ladybug Robot, KSR6

My daughter got a Velleman KSR6 kit for Christmas, and the other day she finished it's assembly. We tested it out and it's motors ran as they should, but the robot didn't turn when closing in on objects. I sighed a bit and started troubleshooting. When looking into the design I started thinking it actually was quite cool. It's control system was made from four op-amps. No digital circuitry at all. I can't publish the whole schematic here, since it's copyright Vellemans, but it can be found in the manual in the above link. I made a simplified Spice simulation of the circuit and made some comparing measurements. I'll briefly explain what the different parts do and compare simulations to measurements:

Simplified LT-Spice schematic drawing

 U1

A pulse of about 1ms is fed through the DC-blocking C1. The pulse in the actual design comes from the IR-diode, which picks up reflected IR from the IR-LED.
U1 is simply a non-inverting amplifier which is AC-coupled using C2. C2 makes the gain roll of to unity at DC.

The big pulse is from the IR-LED, for triggering purposes. The small pulses are from the U1+ node, a high pass filtered pulse.

And the same filtered pulse in LT-spice. Very similar to reality. 
U1 amplifies the positive going pulse to look like this:

Amplified pulse, almost rails the output of U1.

Amplified pulse of U1, looks very similar when simulated.


U2

This is an emitter follower with a diode on the output and a bleeder resistor to ground. U2 can only source current to node U3+. After U3+ is charged,the voltage is kept high by C3 and R4 for a while.
The small pulse of node U3+ is not what we expect.
The simulation shows what I expected. A high step that slowly bleeds out through R4.

So the problem is probably in node U3+. Perhaps a bad connection to the cap or a bad cap. I'll look more into it. In the following sections I'll just explain what is supposed to happen and show the simulations.

U3

Is a slow integrator that keeps the output high while U3+ is discharging. If the original incoming pulse (at U1+) is smaller than some threshold, U3o won't have time to integrate to any significant level before U3+ is discharged. U3o then stays low.
U3o when it has had time to integrate to a high voltage level.

U4

This is a comparator. If U3o is over 3V, U4o drops to it's lowest level. If U3o is below 3V, U4o kicks up to it's max output. 

Complementary outputs of U3 and U4


U3 and U4 has complementary voltage levels at their outputs and the are used to drive the H-bridge to one of the robots motors, making the motor reverse for a while when the robot receives a big echo from it's IR-receiver. This makes the robot back out and spin 90 degrees before continuing forward.