Jump to content

Headache


esaj

Recommended Posts

9 minutes ago, lizardmech said:

I redesigned it with new drivers. These ones are isolated, 4A, they don't have legs so they will be difficult to solder however they're only 5mmx5mm in size which let me put them right next to the fets and cram 12 mosfets. The only thing I'm worried about is the PWM signal even with 4 layers there's not enough space for a solid ground plane. The PWM traces are the red ones on the left, ground is yellow. Looking at other EUC boards they do appear to make gate driver to mosfet trace length a priority over MCU to gate driver.

If it works the mosfets I built it around come in 80V, 120V and 150V, the 80V one is about 1.6mohm and can in theory carry over 100A if cooled, the 150V ones are about 6mohm but with 12 of them it should still be lower than many 67V EUC.

pcbv3.jpg

pcbv32.png

That's really cool, I don't know much about actual board design... An idea that I was playing around with earlier was to add another full copper-clad board underneath to act as ground plane, then drill through the ground legs to there... Haven't actually tried it yet (and I use through hole-components and one- or two-sided prototype boards, so much easier than with SMD/designed board). I've also played around with the idea of getting my own CNC-mill for making my own (single-layered) boards. 

 

With my own projects, another lesson learned: ceramic DIP-packages are slightly larger than their plastic counterparts, and don't really fit right next to each other in the sockets. Had to get a bit creative:

OsygXng.png

:D

The third optocoupler (the white ceramic packaged chips) on the socket needed a bit longer legs ;)  That's an analog function generator I'm building, the couplers are to separate the +5V signals selecting frequency range and output (triangle/sine) from Arduino from the +-12V elsewhere on the board. The optocouplers are the triac-type, which I ordered more or less by accident last november/december, when I was just getting "everything" without yet knowing about the differences. But luckily, they actually came very useful here (as the signal changes polarity, normal transistor-based couplers would have probably messed it up).

The +-12V is produced first by boosting up 12V line from an ATX-power supply to around 28V or so, then filtering the noise (that's what most of the caps on the left are), regulating to 24V and then splitting the rail with LM317/LM337/TL431A. The output has fairly low noise, but the booster switching still shows as a peak couple of hundred millivolt ringing pattern (which very fast diminishes to nothing) occurring around 100kHz. Luckily, it doesn't show up in the output of the actual sine or triangle wave.

Will write a longer post and schematics on it once I get around to finishing it, which might still take a while (this board still needs some fast comparators to produce a nice square wave, and I need to replace the big polypropylene on the right with a bipolar electrolytic or get a larger capacitance polypropylene, it distorts the signals at low frequencies). It already does sine & triangle between <1Hz up to around 450kHz with very minimal distortion (and maybe I'll get it a bit better still by adding a LR-lowpass filter on the output above the maximum frequency). 

Mostly based on this: http://mdiy.pl/generator-funkcyjny-400khz-na-icl8038/?lang=en

Also, the same Arduino will control a 32bit DDS-generator (AD9851 http://www.analog.com/en/products/rf-microwave/direct-digital-synthesis-modulators/ad9851.html#product-overview ) used to produce sine wave up to 70MHz. Still haven't decided on the casing & controls, probably need a couple of inch TFT + rotary encoder + maybe joystick or just a few buttons. BNCs and/or banana jacks for output.

  • Upvote 1
Link to comment
Share on other sites

I've made some progress with the analog function (signal) generator, so I thought I'd do some write up on it... don't know how many people really reads these, but it helps me to get my thoughts straight, plus I sometimes get new ideas when "going through" what I've done so far ;)

So, I'm building a function generator -box for my own use, that will house 1) a digital DDS-generator based around AD9851 (I have one in a breakout-board that can give pretty clean sine-wave up to around 50MHz at 14 millihertz increments) and 2) an analog function generator built around ICL8038 ( http://www.intersil.com/content/dam/Intersil/documents/icl8/icl8038.pdf ), that can produce sine-, triangle and square wave from very low frequencies (< 1Hz) up to around 450kHz. I've based my design around this:  http://mdiy.pl/generator-funkcyjny-400khz-na-icl8038/?lang=en

I've already tested the digital generator, and it doesn't require much else than a few resistors and Arduino to control it. Probably need/want to add a buffering stage for the output, but for that I need fast op-amps (LM6172, 3000V / µs slew rate, still on the way). So I've concentrated on the analog-side for now.

Earlier I was going to use this (which is based pretty directly on the references in the datasheets): http://www.zen22142.zen.co.uk/Circuits/Testgear/funcgen.htm :

funcgen.gif

but the author of the mdiy.pl swears that his design is better (at least I got higher frequencies out from it on a breadboard without much distortion).

As the mdiy.pl has the schematics etc. only available as a rar-package, and most won't bother to download it, I took a screenshot of the schematic-pdf. Hopefully I'm not breaking a gazillion copyright-laws by putting it here, all credits, copyrights etc. belong to the original author:

MEJ3B3M.png

First of all, of course I don't have a 2 x 14V transformer, and I plan to power this thing straight from a 4-pin Molex-connector of the ATX-power supply, so the power-supply is a bit different. Also, I don't have single-pole/multi-throw selector switches (never saw the point of ordering those beforehand, as I couldn't now how many throws I'd need), so I've used MOC3061's (triac optocouplers) to control the selection of timing capacitors and the signal output form. This makes it possible to enable/disable the outputs/timing capacitors from the 0/5V output of the Arduino, although on the other side of the coupler there's a signal of much higher amplitude, and the control & controlled signal stay coupled (ie. they don't affect each other).

Also, the text on the original design mentions that using the squarewave output (which is an open collector, so actually it sinks current), the sine and triangle outputs can become distorted:

The biggest problem of these circuits generators is strong distortion on sine wave output pin 2 at frequencies above 100kHz – so most of the solutions based on this chip has a limited frequency. I found a workaround by not putting the load on the square wave output from pin 9 (open collector that needs to be pulled up to the power supply). In some way the quality of other waveforms is dependent on the load on this pin. Pull-up resistor is activated only when switching output to the square waveform – with the same switch. I got rid of the recommended in the note 10M pot to “improve” the vaweforms. As it turned out its only making them worse, and add a characteristic spout on the top of the upper half of the sine.

So to keep the signals clean, I actually left out using the squarewave output of the VCO totally, and went a bit different route, more on that in a bit.

For the filtering and power stage, I designed fairly simple circuit:

TwHgN4V.png

I simplified the schematic by leaving out most of the filtering capacitors (there are lots ;)). The 12V voltage is taken directly from the PSU-line, and then on one side, there's some filtering + LM7805 (5V linear regulator) for the lower voltage stuff (Arduino mostly). On the other side, I first boost up the voltage to around 28V (26-28V should be sufficient), then filter the output to get rid most of the switching noise, and feed it to an LM7824 (24V linear regulator, in the schematic I used LM7815, because LTSpice didn't have a model for the 7824). As I want a "real" AC output (positive/negative voltage), I then split the 24V output from the middle, to create a virtual ground ("0V") at  around12V (in relation to the ATX ground), halfway between real ground and the 24V output. The rail-splitter is pretty straight from this design:  http://www.head-fi.org/t/654485/virtual-ground-regulated-and-rail-splitter-circuits

LL

Except that I've used TL431 as the 2.5V reference between the LM337 and LM317 adjust-pins. The idea is fairly simple, the TL431 creates a 2.5V reference between the highest (24V) and lowest (0V, ATX-ground) voltages, and the adjustments of the LM's use 1.25V reference both, so the TL431 will keep the adjustment voltages "correct" for the adjust-pins, and they're 2.5V (2 * 1.25V) apart from each other, so they keep the virtual ground steady at 24V / 2 = 12V. I used some slightly different values for the resistors on both sides of the TL431 (the reference-pin of the TL431 is connected straight to the cathode, and cannot take much more than 10mA, although the cathode could sink around 100mA), didn't have 22uF caps, so went with 33uF instead, and different diodes, but basically it's the same circuit. The virtual ground is used as ground reference on the outputs, so I get a nice +-<some voltage> signals out.

I didn't draw a schematic of the actual VCO-part, because apart from the optocouplers, it's pretty much the same as in the original schematic (ie. similar frequency / duty cycle / amplitude / offset -controls). I did leave out using the squarewave output, but instead, I create the square wave from the triangle output. I measured the triangle output signal from the VCO to be between 8-16V (against ATX-ground, so +-4V against the virtual ground), and take that into a comparator. I have two uses for the square wave: first off, of course an actual square wave output from the generator, and secondly, to count the current frequency of the signal, so I can display it through the Arduino, and wouldn't need to use the oscilloscope to see the frequency.

At first, I was planning on using LT1016 (a very fast 10ns comparator that has "active" outputs), and was planning on powering it from the same 5V regulator that I've added for the Arduino. Unfortunately, it turns out that it's actually a bit TOO FAST and sensitive :D  Even slight ripple in the VCO output caused the comparator output to jump up and down at several megahertz frequency when the signal was passing over the comparison voltage ("inverting input" of the comparator). The datasheet for LT1016 states that you shouldn't use sockets with it, and should have a separate ground plane to keep it steady. As I don't have a ground plane (yet, actually I will have, get to that in a bit), plus there's always some small & high frequency ripple in the voltages due to using switching power supply (and the booster on the 24V side, which actually causes a lot more ripple), so I abandoned the idea of using those here. Instead, I did have some LM319's (LM119 in the below schematic, because again, there wasn't a model for it). It's a fast (80ns) dual comparator, and on the plus-side, it can actually use voltages of up to +-15V (30V). At first I didn't actually notice that, and used it with the 5V supply, but after checking the datasheets again, I changed it to power from the 24V:

sCYIlmy.png

So, I pull the triangle wave from the VCO through a 100k resistor (to not load the output, plus the comparator has a very large input impedance and doesn't need much current on the inputs) to the non-inverting input of the comparator, and take the inverting input (comparison voltage) directly from the virtual ground, which happens to sit at the middle of the VCO output. That way, I get a nice 50% duty cycle "fairly clean" square wave out of the comparator. Unlike LT1016, this comparators outputs are open collectors, and can handle up to around 25mA, so I can use whatever voltage I see fit on the other side (well, up to a limit of course, but anyway...). The output is pulled high by a 680 ohm resistor (that causes about 7.4mA of current to flow through the output transistor in the comparator), I first tried larger resistors, starting with 10k, but the rise time of the signal would be much higher. These measurements are either with 1.5k or 2k resistor (don't remember which):

niIt5U1.png

The rise and falltimes + rates (volts per second) are shown at the bottom. Do note that the Rigol measures rise and fall times based on 10% and 90% of the vpp, so the actual total rise time is a little higher.

Agpb2DC.png

It is also capable of measuring over- and preshoot percentages, as well as variance and a lot of other stuff, which is nice, but maybe not that necessary. Thumbs up for a 400€ scope, though ;)

Here's the ringing/ripple from the power supply / booster, unfortunately it DOES show up in the final waveform, but I'm planning on adding a ground plane and it might get lower with more load on the output, we'll see. Also, it isn't that strong (note that the grid squares are 50mV here:)

nwaysEC.png

With 680 ohm, I got a nice fast rise:

WTultiI.png

Zooming in, I got more precise measurements of the rise (it seems that the "resolution" of the bottom measurements depends on the time scale for horizontal values, and voltage-scale for vertical values):

1iggA2e.png

"Fast enough", and it seems the comparator can easily reach that promised 80ns rise. Since this signal is pulled to 5V, I can feed it directly to the Arduino through an external interrupt pin, and count the frequency from there :)  At first I thought of using the Arduino input-pullups, but probably better to use a separate resistor, so I get that fast rise time. 

So, now I got the analog triangle and sine-wave outputs pretty much finished (might want to add an LR-filter at the output to filter out high frequency ripple transients and the ringing patterns). From what I've read, the ringing is typically caused by impedance mismatch (well, I don't know the impedance from the booster etc., and don't think I can measure it) and/or too high resistance/impedance in the ground path. I can improve the ground path with a separate ground plane though.

I borrowed a friends' "hand-cranked" milling machine and drilled holes on a copper-clad board to match the holes on the ground trace in the actual board (and that was slooow work, I want a CNC so bad now :D):

371104_xl.jpg

b18KPlH.jpg

That should give the charge carries ample "space" (actually, area, as the higher the frequency is, the closer to the surface of the conductor they move) and hopefully reduce the ringing and maybe even ripple. For that area-reason ("skin effect" in wires), I've also used 24AWG multistrand-wire for the signals on the board, don't know how much that helps in reality though ;)  The idea is to use pin headers on the bottom of the actual PCB to connect the ground traces directly to the copper-clad board:

6udhzzT.jpg

But, first I want to make sure that the board is really finished & good, as removing that plate after all the pins are soldered would be a real pain. Another option would be to use male-pin headers on the actual PCB and female headers on the copper-clad, so I could remove it easily if the actual PCB needs to be reworked, but that would make poorer contact than directly soldering the pins on both ends. Also I haven't actually tried whether the ground plane even makes much difference... :P

So, the point at which I'm at right now is that I want to get the square wave output done (the other comparator of the dual LM319 is still unused). One thing I have designed so far is the duty cycle control:

fAR6OCK.png

It's actually really simple to do, because the output of the VCO is a triangle wave: basically I just "move" the comparison voltage between 8 and 16V to get a square wave with a duty cycle between 0% and 100% (or vice versa):

JSdpOBU.png

The red line is the comparison voltage from the voltage divider, the green wave is the VCO output and the blue is the square wave output of the comparator. In the above, the comparison voltage is at 10V, producing about 75% duty cycle. Here's another simulation picture with around 25% duty cycle with higher comparison voltage:

rMqY8sU.png

 

In the above simulation, the output of the comparator is again pulled to the 5V line, but I think I want to use the 24V line and the virtual ground on the actual output. The next step I need to figure out is how to control the amplitude of the square wave, and I'd also like to be able to control the offset around the virtual ground, so I could get for example 0...+5V output or -5V/+5V or (nearly) -12/+12. Also, the output should (probably) be buffered anyway, and I could use similar amplitude and offset-controls as in the triangle and sine outputs, but for that, I need those really fast opamps. The fastest I have is around 30V / µs LM6142, and that's not nearly enough for pretty much vertical raises and falls at several hundred kilohertz.

For buffering, I had a couple of ideas. I tried a basic BJT-transistor switching and a common emitter amplifier, and although the results were "OK'ish", I wasn't completely happy with them, especially as the component count goes up (I know I probably won't be able to fit them all on that board anyway, though :P). Also tried mosfet-based ideas, but these are pretty preliminary:

HlodzZa.png

Simply pulling down the 24V line with a small mosfet gives a fairly clean output signal between 0V and 24V (or -12V and +12V in relation to the virtual ground):

MHcueiN.png

The blue line is the comparator output at 5V (didn't take into account that it has an output resistance of 680 ohms here, though, so the resistor value is wrong), and the green one is the output from the mosfet drain. The output resistance / impedance of this circuit would also be 1k ohm, so not that good either.

Also though of more like a push-pull / totem-pole output built around power-mosfets (power mosfets only because I don't have "normal" P-channel mosfets :D):

501MFsG.png

The problem here is that even though the gates of the mosfets I planned to use have relatively low gate charges (around 25nC each), I need to use 24V output from the comparator to pull the high-side P-channel gate to source-level (so it stops conducting), and to do that fast, a lot of current is required. If I use a low resistance as pullup at the comparator output, it's going to fry the output transistor when it goes low... :P

Also, these designs only act as a buffer on the output, I still need to figure out how to handle the amplitude control and offset. Probably need to wait for those fast opamps...

Another thing I'd still like is ability to measure the positive and negative peaks of the outputs and show them with the Arduino (I'll likely put a 2.2" TFT-display on the device). But, that's a bit trickier to do, I was thinking of something like basic op-amp/diode/capacitor -based peak detectors, then dividing down the voltage for the 0...5V analog input of the Arduino, but still have to fiddle around with those. It's maybe not strictly necessary even, as I could just mark the amplitude/offset values next to the potentiometer knobs at the front panel, although the amplitude will be different at sine vs. triangle outputs, because the VCO outputs are different, about 10...14V (+-2V) for sine and 8...16V (+-4V) for triangle, so the the same position of the amplitude knob will be different amplitude depending which one is enabled.

That's it for now. I anyone has good ideas on the amplitude/offset control for the square wave, or measuring amplitude/offset for the Arduino, I'm all ears (or eyes ;)).

 

 


 

 

Edited by esaj
Link to comment
Share on other sites

think I might have finally solved my problem of adjusting the square-wave amplitude without fast op-amps:

wxyjZp2.png

Basically it's two push-pulls after another, the first one just feeds the second one, with a voltage divider inbetween. Depending which of the two transistors (Q1 or Q2) in the first one is conducting, the potentiometer U1 in-between the push-pulls will form a voltage divider with either the upper or lower resistor (R5 or R4) to adjust the voltage (and actually the other one will then be in parallel with the U1, might have to tweak around the resistor values still). The final voltage over the R_load will be one junction forward voltage (around 0.7v) below / above the voltage at the divider, so it can't reach the rails, but it's not strictly necessary... At least it seems to work, I haven't actually tried it in real life yet ;)  And it's still somewhat simple (compared to some of the monstrosities I tried earlier today :D).

Link to comment
Share on other sites

I tested a slight modification of the above circuit last night, and for the first time ever, managed to melt a TO-92 -packaged transistor :D  The modified circuit caused very large power dissipation in one of the transistors and I had missed it in the simulation ;)   First sign of trouble was a smoking 10K potentiometer (yes, it was actually pushing out thick smoke), after which I turned the circuit off, took the potentiometer out (I was planning on measuring the first stage), but after turning it back on, one of the transistors melted within about 10 seconds :D  The reason seemed to be some diodes I had added at the bases, that weren't really necessary anyway.

But the circuit in the above post (without the modifications) worked fine, after I replaced all the transistors with 2N3904's and 2N3906's. With 2N2222's and 2907's, the voltage wouldn't rise above 12.x for some reason. I even tried matching the complementary transistor-pairs to have the same hFE, but it had no effect. Well, it was a long shot anyway... fiddling around with it for some hours, I decided to try the different transistors, and everything worked as expected. Don't know why the 2222-2907 -complements won't work as expected, but maybe I'll find out some day :P

Anyway, continued to tinker with the circuit in the simulation today, and I think (again) I have more or less working version to test with (in lieu of fast enough op-amps):

27Dl7Rl.png

It's pretty much the same as before, other than that I've added yet another stage that handles the offset of the signal ("moving" it around the virtual ground). It's not perfect, and the offsetting attenuates the amplitude further, and it cannot go "all the way" to only positive/negative side, just move around the virtual ground, but it's the best I've come up with yet. 

Edited by esaj
Link to comment
Share on other sites

I actually finished (well, I still might redo it at some point, but not for now ;)) the square-wave output stage some time back, but didn't bother to write about it then.

The current "final"-version looks like this:

57dx3vX.png

Actually, there aren't that much changes from the original, but the couple things added make a big difference.

First of all, I've separated the open collector-output of the comparator (BTW, I was happily mixing up rise time and propagation delay earlier, the 10/80ns values for the comparators are the delays, not rise times :D) by using the output to switch another BJT, that then controls the first push-pull stage (amplitude adjustment-stage), which is now fed through a 1K resistor instead of 10k. The "R2"-resistor there with a value of 28k is actually a 22k resistor + 10k trimmer, as I found out that the resistance between the 24/12V virtual -rail and the open collector output affects the duty cycle (ie. the duty cycle of the final stage output will be different than that of the comparator output using "wrong"-value, the resistance needs to be adjusted so that the output of the final stage matches the comparator duty cycle). In my case, the "correct value" was somewhere between 27.5-28.5k (don't remember the exact values anymore, and I didn't write them down ;)).

Second change is in the amplitude adjustmetnt-stage, which now has an extra pulldown called "R_EXTRALOAD". This one's pretty important, but I'll get to that in a bit.

Finally, the offset-adjustment stage now uses a 1MEG (1 megaohm) potentiometer, as I found out that larger resistance value there gives a larger range for the offset adjustment.

So, I now have a output-stage for the square-wave output that makes it possible to adjust the amplitude and offset, and have made some important changes in the original to get much better output. Unfortunately, it's not exactly "perfect", but I think I'll go with this anyway for now... ;)

After building the circuit in the latest post (above this), I found out that while it worked, I had very long rise-times. Here's a couple of screenshots from the scope-traces, I don't actually remember if this didn't already have some of those changes I've described above:

wEeEJNQ.png

The output from the entire circuit (ie. going to R_load) is shown as the magenta trace (the topmost-one, channel 3), and it's frequency/rise/fall and min/max voltages are shown at the bottom. The rise time is pretty slow here (430ns, at around 467kHz, that's like 1/3rd of the entire pulse!), and the shape somewhat resembles what happens when charging a capacitor. The 2nd channel (greenish) and the channel 1 (yellow) are either the amplitude or the offset stage, or the voltage at the input of the first stage, don't remember which anymore (should have written down some notes :rolleyes:).

FHZulRs.png

There's some ringing occurring at the fall, but nothing major. Not really my worst problem at the time.

m1no9j4.png

There's also a slight "knee" at the middle of signal, the point where the lower transistor shuts down and the upper one starts to conduct. Not that smooth transition.

Dwci0Ow.png

Furthermore, dropping the amplitude and moving the offset, the rise time got even slower, and then also the fall-time slowed down! That's more like a triangle-wave than square.

BMWJhwr.png

At lower frequency (6.71kHz here), the rise time gets even slower, but here it doesn't really show, as the pulse-length is much higher than the rise and fall, so they look like almost vertical rise & fall.

I tried all sorts of tricks to speed up the rise, to no avail, like removing the capacitors around the offset-control: Nope, the output just becomes really skewed, and the rise & fall are even worse.

GKqHT5t.png

Probably somewhere around here I noticed that the duty cycle of the output was off in regards to the output of the comparator, and found a way to fix that (adding the "pre-driver", for the lack of a better name). And also (if memory serves), that the larger valued potentiometer made the offset-control better. After several hours of trying things and trying to find a mention somewhere what causes a slow rise time, I could only find threads and articles speaking of slow fall-times (usually the fixes mentioned where the speed-up capacitors and/or negative biasing of the base).

Then, while going through the datasheet of some BJTs for the umpteenth time, I noticed one of them had a graph showing the rise time vs. the emitter current (or was it collector current, anyway). That's when I realized that the rise time is affected by the current. I added pull-down resistors at the push-pull stages, and found out that pull-down at the amplitude-stage made the rises faster. A lot faster.

YphtRLh.png

Funnily, the rise just gets faster after each stage. The downside is that it adds a more pronounced ringing, that's actually larger after each stage. For now, I'm not sure what to do with that.

JTaRqUF.png

There's also a small rise just before the signal starts to fall, nothing critical though, and some ripple (probably from the power supply/booster).

So, the rise time is good at high amplitude (I even got it down to 30ns at highest amplitude by some changes, probably using a lower valued pull-down, 1K is what I used finally as the R_EXTRALOAD). It's a 1W resistor, because at full amplitude, it needs to drop around 24V over itself, so it does dissipate a lot of power and gets a bit warm ;) 

Then the bad news:

LPOBzTm.png

At low amplitudes, the rise and fall times get significantly higher and there are clear "plateaus" at the middle of the rise and fall. Haven't found a "cure" for these yet, I tried some diodes at some places, but the best I got was getting rid of the plateaus, at the price of even higher rise and fall time:

VlxUHxL.png

So in the end, I left them off. Finally, here's a (poor) FFT from the output signal (the Rigol isn't that good as a spectrum analyzer, as you can see ;)):

m2WHc18.png

Compared to the signal, I'd say that the isn't that much low frequency content there as the FFT seems to show...

For now, this is the stage where I'm at. I've already built the circuit on a small board, but might have to redo it. Maybe using smaller valued potentiometer and pull-up/down -resistors in the amplitude-stage could be the key. Another option I though of was to make another output-stage with lower maximum amplitude...

Also, I've (as usual) done a few side-projects here, like the voltage-display that plugs directly into the charge port and self-powers from the battery (in the mods-section, it's really simple, just a TL783 high voltage regulator & ready-made 0-100V 7-segment led display), and done some testing & research into building a milliohm-meter with HX711 (a very cheap 24-bit ADC meant for digital scales, hobby16 pointed me to it and even sent me one! :)) & constant current source. Also "lost" a lot of time with a digital potentiometer, as I was following the original datasheets, and they suggested a far too high separation resistor for a multiplexed SDI/SDO, but maybe that's worth its own post some day :D 

Also, the milliohm-meter testing directed me to a (yet again!) new project: I "need" to build a DC-supply that has no ripple, basically it isn't much more than bunch of fixed & adjustable linear regulators powered by a 7.2V (nominal) NiMH- and 11.1V (nominal) LiPo-packs I have, and some protections. But I try to keep from starting that, as I'm going to run out of desk-space unless I finish something in between :D

Edited by esaj
Link to comment
Share on other sites

7 minutes ago, lizardmech said:

The TL783 is too fragile to work with the same power source as a motor I have found. Blows up everytime I run the motor. It probably needs many power filtering components to survive.

Any idea what exactly is causing this? Voltage spikes from motor?

Link to comment
Share on other sites

Yet another slight side-step; after fiddling around with the Firewheel-board, I somehow ended up playing with a MAX7219 (a led-matrix / 7-segment display driver), and ended up taking a couple of hours to make a simple digital speedometer:

zBdU64o.jpg

It works just like bike-speedometers, there's a tire circumference programmed into the Arduino, and it uses an external interrupt to measure the time (in milliseconds) that goes between the signals (that would come from a reed-switch or such in reality, I just used a microswitch and a small capacitor to filter out the switch vibrations). It updates (currently) about 15 times per second, and uses a simple moving average to make it more "lively" (ie. the speed "runs" up and down, and doesn't just "jump" from one value to another). The speed only runs down to 0km/h if there isn't a signal received within the last 3 seconds (which with a tire diameter of 1000mm would mean speed below about 1km/h).

Already had some ideas on how to improve it (more magnets in the tire rim for faster updates, or using motor hall-sensors through a high-impedance buffer, like an op-amp or comparator), and how to make it possible to change the tire circumference with two buttons instead of changing the program...

Maybe I'll fiddle around with it again later on and write a post in the mod section (DIY: Digital speedometer). Again, very simple project, since basically it's just 4 seven segment displays, MAX7219, one resistor to set the current for the display (maximum brightness), signal input and a small program. Probably could fit into a ATTiny85-board to drop the cost / make it a bit smaller, as it only needs one external interrupt and three outputs.

 

 

 

Edited by esaj
Link to comment
Share on other sites

Another lesson learned... Not completely happy with the push/pull-output stage I did for the analog function generator, I decided to wait for the fast op-amps. I got the LM6172's in SOP-8 -packages, but I got some adapter boards. Not a fan of SMDs though, mostly because I suck at soldering them :P  But not that bad end-result, even if I do say so myself ;):

nzHx8y2.png

Anyway, I then wanted to make sure this is the real thing, and not a counterfeit. For that, I simply set up it for open-loop gain with a few kHz square-signal from a 555-chip and set the non-inverting input to about half the voltage, then started measuring the slew rate. LM6172 should get up to 2500-3000V/µs, which is really fast (other op-amps I have are something like <1...30V/µs).

I won't bore you with screenshots from the scope, but my first results were only around 7.xx V/µs. Counterfeit shit! Although I paid "only" around 55 cents per piece, it's still among the most "expensive" op-amps I have. I was about to start writing a scolding message to the seller, but then calmed my nerves and tried to think about if there's something wrong with my test setup. It should drive the op-amp as fast as possible to the highest and lowest voltage it can get. Breadboard and some long wires I used there probably cause a lot of parasitic capacitance and inductance. Still, around 7V per microsecond is a far cry from 2500-3000. Better check what the datasheet says. And there it was:

The slew rate of LM6172 is determined by the current available to charge and discharge an internal high impedance node capacitor. This current is the differential input voltage divided by the total degeneration resistor RE. Therefore, the slew rate is proportional to the input voltage level, and the higher slew rates are achievable in the lower gain configurations. When a very fast large signal pulse is applied to the input of an amplifier, some overshoot or undershoot occurs. By placing an external series resistor such as 1kΩ to the input of LM6172, the slew rate is reduced to help lower the overshoot, which reduces settling time.

Lower gain configurations. I was using open-loop gain, which is as high gain as possible. D'oh. I then used a similar setup as in the datasheet (an unity-gain inverting amplifier with 1k resistors) and left the non-inverting-input at half the supply voltage (made with two 200k resistors, maybe they should have been smaller too). 12V: 400V/µs. 15V: 500V/µs. Umm... probably a good thing I didn't send the message to the seller :D

I've still got some LM7171 (1.50€/piece for DIP, 4100V/µs) coming, both in DIP & SOP-packages...

 

  • Upvote 1
Link to comment
Share on other sites

Wow @esaj, that is awesome! It has been decades since i used an oscillator and signal generator and even back then I had no idea what the hell I was doing! All analog of course. I us to build alot of Heath Kit stuff with full blown instructions (insert 'b' wire into circuit board hole labeled p). My solder joints usually bridged each other?Yours is custom engineered! Nice clean layout. Impressive man!

Edited by Rehab1
  • Upvote 2
Link to comment
Share on other sites

2 hours ago, Rehab1 said:

Wow @esaj, that is awesome! It has been decades since i used an oscillator and signal generator and even back then I had no idea what the hell I was doing! All analog of course. I us to build alot of Heath Kit stuff with full blown instructions (insert 'b' wire into circuit board hole labeled p). Yours is custom engineered! Nice clean layout. Impressive man!

Thanks, although these are fairly basic circuits still... On the other hand, at least I seem to have reached a "level" where I can design my own circuits and (semi-)confidently build stuff that uses things like lithium-batteries without needing to fear they'll blow up in my face the second I turn the power switch ;)  Of course, I first checked with a continuity meter to make sure that at least the battery inputs or such isn't in short-circuit before attaching any batteries :P

I still rely heavily on the simulations in my "designing process", which is sometimes almost pure trial & error, but at least I nowadays (usually) get the basic stuff correct in (almost) one go. The simulations also helps a lot with redesign / changing values, because you don't need to recalculate everything by hand again :P  Were it not for LTSpice, I wouldn't have even begun to learn electronics (sort of again, I have some background from long ago).

 

2 hours ago, Rehab1 said:

My solder joints usually bridged each other?

Soldering is the kind of skill which takes some time to develop, but it isn't really hard (well, maybe if you solder SMDs, that's surface mount devices, especially the very small ones :P). There are lots of tutorial-videos around youtube and such which show good tips & tricks how to make good joints etc. One of the best ones I've seen are from 70's (or maybe early 80's) by Pace corporation:

https://www.youtube.com/playlist?list=PL926EC0F1F93C1837

Although I can't say that I really follow each and every of their way of doing things at all times :P   Some of the tools and stuff they use might be outdated, the basic idea of controlling heat transfer is still at the very core of making good joints, and they have good tips on soldering different type of connectors. Of course just watching the videos won't make you perfect (and I'd be lying if I'd claim all my joints always come out perfect :D), it takes practice...

Also proper tools of course help a lot. I started with a large "supermarket"-soldering iron, that had only very large tips and no heat-control. No idea what type the tips were, so couldn't look for smaller ones. The end results were often poor ;)

I then bought one of these (10€ at the time):

http://www.aliexpress.com/item/EU-Plug-high-quality-907-Adjustable-constant-temperature-Lead-free-Internal-heating-electric-soldering-iron-220V60W/32445497395.html

EU-Plug-high-quality-907-Adjustable-cons

It has temperature control, that at least seems fairly reliable, and uses "standard" (Hakko) 900M-tips... although, I had trouble with fitting other 900M tips on it, it seems the tip that came with it has slightly different sized hole inside it. Also, the handle heats up in longer use periods, and it's fairly bulky and not very comfortable (the handle is clear plastic with edges, not a round one).

The next one I got was this (I paid 7.40€ at the time, not from this seller, the original store no longer seems to have it):

http://www.aliexpress.com/item/220V-60W-Adjustable-Temperature-Electric-Iron-Welding-Soldering-Iron-Solder-Rework-Repair-Tool-5pc-Iron-Tip/32434361333.html

Hot-Sale-220V-60W-Adjustable-Temperature

 

Again, it uses 900M tips (you can get a basic set of 10-14 different tips for something like 5€, unless they come with it). It's pretty small, has heat control, and the slim shape makes it comfortable to use, you can hold it almost like a pencil. So did I find the perfect iron? No. The handle heats up somewhat (not uncomfortably though), but the real problem is that the heat control doesn't seem to really work. It seems more like it's controlling some PWM-duty cycle or such, so the tip becomes hotter than the setting over time. Too bad, this would be my favorite otherwise.

My main tool for the past few months has been this though:

http://www.aliexpress.com/item/High-precision-936d-LCD-Adjustable-temperature-Digital-Electric-Soldering-station-EU-plug-Replace-HAKKO-936-Soldering/32576513511.html

Free-shipping-EU-Plug-CXG-936d-led-tempe

900M tips. Heats up FAST (I don't know if the 8 seconds to 350C is correct, but can't be far off). It's comfortable to work with, then handle doesn't get too hot. Also, as it's so fast, you can just unplug when you aren't using it for a few minutes, then plug it back in, and it'll be ready to use in no time. The heat control seems to work fine. Note that there are two different versions, which are named CXG 936d and CXG936D (so the difference in the name is the non-capital/capital last letter :D). The "capital D" -version has something like password-protection (What? :D) and I don't remember, maybe something else. Probably not worth the extra money though :P 

So if you're looking for a "good enough" soldering iron on budget, I'd say go with the CXG 936d. Otherwise, be prepared to shelve out >100€ for a proper station ;)

A couple of tips from a not-so-experienced solderer:

-Wipe clean the "storage" tin from the tip, thermal shock & pretin the tip before use
-Apply heat first (the pretinned-tip helps with transferring the heat better), then solder, then keep the tip for a second or two there before removing it
-Watch how the melting solder "moves" during application to know if you have too little heat
-Always "storage"-tin the tip at the end of the use, it will keep you tip in good shape (it won't corrode/oxidize as easily)

Typically I use around 320C as the heat-setting, lower for more sensitive components (something like 260-280 for SMDs, TO-92 transistors I might go with 280-320), higher for larger thermal masses (for large connectors for example, I use 350C or more). The thing is, if the tip isn't hot enough, you'll just have to keep on heating the pad/component leg for longer, usually ending up also heating the component itself more. With "enough" (but not too much) heat, you can go fast in, fast out, and only the area you're supposed to be soldering gets really hot. I must admit that I don't change the tip often, usually I do almost everything with a 900M-T-1.2D  (a 1.2mm chisel tip). :P

Use separate flux-paste or such if needed, 99% of the time the flux in the solder wire itself will be enough (of course there are differences in wires too ;)).

There's a pretty wide selection of 900M -tips available, these are not all of them:

Quality-Soldering-Tip-900M-T-I-Conical-S

467202861_138.jpg

 

Edited by esaj
  • Upvote 1
Link to comment
Share on other sites

After getting the battery-PSU out of the way and my desks cleaned up a bit, I've made some progress with the analog function generator.

I tried to create a discrete control for amplitude & offset for the square-wave output (buffered trianglewave through LM319N, I used trianglewave-output so I could have duty-cycle control by moving the comparison voltage "along" the ramps). Although it (mostly) did work OK(ish), I still wasn't really happy with the end result, so I decided to wait for the fast op-amps to do similar circuit as there's in the sine/triangle-output. And then I had yet another Firewheel-episode, the DIY speedometer, some other smaller odds and ends, and the battery PSU in-between before getting back to this.

I earlier made a groundplane-plate to add beneath the board once I was "otherwise" done with it. I thought I'd grab a bunch of scope pictures to see how it affects things (so I could have something for reference). But, I'll put them later in this post with the "after"-pictures, so it's easier to compare them.

Before that, here's a couple of pictures showing the voltage dropping fast towards the virtual ground at the highest and lowest points of a sine wave:

TsUvxmc.png

 

vKChSeu.png

 

Nevermind the yellow frequency-reading at the top right corner, the real frequency is shown at the boxes below the signal (144Hz and 7.5kHz). The guy who did the original version ( http://mdiy.pl/generator-funkcyjny-400khz-na-icl8038/?lang=en ), to which this one's very heavily based on, said:

Adding the DC offset regulation to the circuit in such a way that has been done here, has a one disadvantage – waveforms (particularly square) will be having a discharged capacitor effect at a very low frequencies (below 100Hz) – this is the DC offset adjustment potentiometer support capacitor. Its marked as 10uF bipolar on the schematic, but its good to put bigger one to reduce this effect.

So, that must be what he meant with the capacitor getting discharged with low frequencies... Luckily, I had just received some bipolars, and before installing the ground plane, I also switched the 10µF bipolar electrolytic I had on the board with a 47µF one.

BTW, do note that it MUST BE bipolar, if you ever try to build a similar amplitude/offset-circuit; the other end of the capacitor is on the virtual ground, whereas the other end can be moved above and below the virtual ground, meaning that the polarity changes. Use a bipolar electrolytic or some other bipolar-capacitor (but due to the capacitance-value needed, there aren't that many options outside electrolytics), NOT a "normal" polarized electrolytic capacitor, unless you like exploding things and picking metal shrapnel off your skin or eyes ;)

 

 

I decided to also "reinforce" the virtual-ground path (the actual ground plane is the "real ground", ie. -12V from the dual supply "point-of-view", the lowest voltage in the entire circuit).

o19zoKt.jpg

 

That should help in lowering the impedance on the virtual-ground (or in the worst case, just add more stray capacitance / inductance, and make things worse ;))

I didn't actually bother to test the board in-between here to see if that had any effect... :D

Then it was time to install the actual groundplane. I had earlier on tested that it does indeed fit and the holes are in right places. I started by using "pin headers" to first attach the actual PCB-side. 

GyPmmiY.jpg

 

As there are components connected to the actual ground, I had to push up the pins at those spots. Also I had to make sure that the pins don't go too "deep" through the PCB, as there are "naked" copper-jumper tracks at places which go over the long virtual ground/real ground traces, and I didn't want to get a short circuit there. All in all, it went pretty well.

x8barWd.jpg

 

Here the headers are already soldered, I had more pictures of placing them, but figured it's not that interesting ;)

YHLXeLO.jpg

 

It took some (slight) force and bending around some pins a bit to get the copper-plate in place, but finally I succeeded. The plate's not covered in anything like photoreactive film or such, so I didn't actually polish it other than scrub it down with isopropyl alcohol.

oDdS4VS.jpg

 

I bent the longer pins to sides and got ready to solder. I did put a lot (in my opinion) of flux paste there to help with the soldering. The tip I started with is on the right in the picture (like this:
900mt4c-475x475.jpg


)
The C-tip seemed to work well otherwise, but it would spread the tin around too much in my opinion. Maybe a smaller diameter one would have been better. I then changed to a smaller, round-ended tip
hakko-soldering-tip-900m-t-b-vmart126-14

 

X9yA1lm.jpg

 

Here the soldering's finished and the extra flux has been cleaned off already (or is it? Either I used the wrong picture here, or those droplets are isopropyl alcohol that hasn't evaporated yet... :D). Well, probably not professional quality, but I'm happy. I did try to scrape the edges of the solder to see that it had wetter properly, and it didn't "slice" off, ie. the copper has mixed with the solder and made a strong bond (I used around 330C heat with highly activated Stannol 2630-solder wire, which is said to work better on larger surfaces that have large thermal capacity).

So, was it worth it? Here's the comparison measurements (and some others which I don't have comparative images of ;)):

Very first measurement I did was with the board hooked up to the PSU, but the PSU outputs turned OFF (ie. the PSU itself is powered, but no voltage should go to the board). However, the PSU actually "leaks" a bit, either through the mosfets, or by the ground-level of the PSU itself shifting with the switching action:

Before groundplane, using one of the ground-terminals of the PSU for the probes:

QZsKV0D.png

 

The yellow channel (channnel 1) is at the input capacitors (that are supposed to filter out any ripple and noise), and the blue (channel 2) is at the output of a LM7824 -regulator, that regulates the around 27V voltage from a boost converter to 24V (and then it's further on split in half to create the virtual ground). It seems the PSU is switching around 390kHz frequency (but there's too much noise to really tell). Interestingly, there's higher amplitude noise at the output of the LM7824 than at the input (remember, the supply voltage should be 0V here).

Same with groundplane, same channels & volts/time per square, using PSU ground terminal for probes:

PrKH8Db.png

 

Not bad at the supply capacitors, the ripple vpp is much smaller (around 60mV vs. 120mV before adding the ground plane). Oddly, the noise at the LM7824 output is actually higher now than without the groundplane. Of course this is a somewhat meaningless measurement, as there's no actual power in the circuit ;)  But it is doing "something".

Another thing I tried was to put the probe ground directly to the ground plane (still with the supply voltage off):

VWgTcli.png

 

The LM7824 output seems to put even higher amplitude noise than before, but the noise at the input capacitors is dropped to below 30mV (do note that the yellow channel is now set to 20mV/grid square, before it was 200mV per grid square).

Well, time to actually start up the thing to see something happening ;) Similar channels as before, but with the circuit actually powered, AC-coupling (the actual input voltage is around 27V, and the output from the LM7824 is 24V), without ground plane & PSU-ground on probe:

wSO3ej1.png

 

That's quite noisy. The PSU switching still is clearly seen as spikes in there, but there's also other noise... lots of other noise :D

With the groundplane, probe ground at PSU-terminal:

t1kV0lg.png

 

The input caps have far less other noise than the switching spikes, and also the LM7824-output has less noise (both in amplitude and in "amount", if you just compare the signal graphics). Well, not a very dramatic difference, but certainly less noisy.

Of course I still measured it using the actual groundplane as ground for the probes:

CHwKuWx.png

 

Even the switching noise seems to (almost) die off at the input capacitors, yet the LM7824 output seems noisier than compared against the PSU ground. Go figure.

Here's a couple of images I don't have the comparisons with the ground plane. I was earlier testing to see if using a low-pass filter in the 27V input voltage would help:

qKjtOuj.png

 

3rd order low-pass filter with 2x220µH inductors and 1000uF capacitor at the input. The noise amplitude is lower, but there are now more spikes than before (something's adding harmonics?).

And another, 2 x 1MH inductors + 3 x 1000uF capacitors (so that's a 5th order filter?):

FAMvJXA.png

 

Eww... there's actually more noise than without any filter :D  I gave up on the idea of trying to filter off the switching noise, thus I have no comparison images with the groundplane.

Ok, so there's at least some noise at the input. Does it really matter? Many components like regulators have at least some "immunity" to ripple in the input voltage. Time to take a look at the actual outputs.

Without ground plane, around 300kHz sinewave-signal, channel 1 (yellow) is the chip-output (before buffering/amplitude/offset op-amps), channel 2 (blue) is the controlled output.

ZPlIpFl.png

 

Not bad, looks fairly clean. There's a small notch after the peak/bottom values though.

With the ground plane, probes at PSU-ground:

czLKdWl.png

 

Pretty similar, the notch is still there though.

With the ground plane and using it as the probe ground:

9NrYod5.png

 

The notch is still there, so my ground plane doesn't seem to help it.

Closer look at the sine waves, before ground plane:

o6hVih4.png

 

There's ripple clearly in the output, not much, but it's there.

With the groundplane, PSU ground for probes:

VQxgV00.png

 

I actually made a small mistake there; I used the RUN/STOP -functionality of the scope to stop the measurement, because it takes a long time save an image when there's lots of other calculation occurring in the probe (ie. if you're zooming, there's high frequency content, lots of statistics being measured etc.). Even if you're using "visual persistence", it doesn't show it in the image capture, even if it's displayed on the screen with the stopped image...

So I took another shot with the measurement running and the peak zoomed closer.

8P66Rev.png

 

Yup, still ripple there.

With the ground plane as probe ground:

2btznzO.png

 

Visually, it would seem there's slightly smaller amount of ripple. Maybe it does help a bit then? ;)

Then, finally the bottom end of the sine-wave, no groundplane:

HwPdLfp.png

 

With groundplane, PSU-ground for probes:

V0F88lD.png

 

And closer look (I haven't actually written down whether I used PSU or the groundplane as probe-ground here :D):

H0Ocn9U.png

 

That's it for those measurements. But those "notches" started to bother me, as I saw them also at the higher frequencies. Was the 47µF capacitor somehow too BIG for the compensation? I didn't want to start desoldering it, so I started measuring and testing things. Maybe the mdiy.pl -guy was wrong when he said:

The biggest problem of these circuits generators is strong distortion on sine wave output pin 2 at frequencies above 100kHz – so most of the solutions based on this chip has a limited frequency. I found a workaround by not putting the load on the square wave output from pin 9 (open collector that needs to be pulled up to the power supply). In some way the quality of other waveforms is dependent on the load on this pin. Pull-up resistor is activated only when switching output to the square waveform – with the same switch.

I had left the pin 9 floating, as I was taking the square output through a comparator from the triangle wave. Measuring what's going on at that pin:

FZwDPw6.png

 

Channel 1 (the yellow one) is the voltage at the square output pin, channel 2 (blue) is the sine-waveoutput. As the transistor at the square wave output starts to conduct, it actually pulls the voltage to BELOW the ground-level for a moment. Maybe it does need SOME load to steady things, floating collector could pick up noise from around it? 
I soldered a female pinheader there, and tried to put some load on the output from 5V, 12V and 24V (in comparison to real ground). No effect on the notches. During switching the frequency ranges (using different timing capacitors), I first noticed that on some capacitors it didn't seem to occur at all, whereas on others, it was always there. A faulty capacitor maybe?

aOvwWFc.png

 

Channel 1 (yellow) is again the square output pin of the ICL8038 (pulled to 12V line through a 10k resistor), channel 2 (the "blue", well actually in the screenshots it looks more like blue/greenish) is one of the timing capacitors discharging & charging (so not the actual triangle output of the chip) and channel 3 (the magenta one) is the buffered output. The notches are still there, so load or no load on the square wave output doesn't make things any better.

lj52ugv.png

 

While doing more measurements and jumping back and forth the different timing capacitors, at one point I noticed that I wasn't getting consistent results; the notches mostly be there, but sometimes they would disappear even on the 
ones where they earlier occurred. Oh shit, I think I know what's going on...

I started poking at the wires that run between the connectors on the PCB and the breadboard I've put all the adjustment potentiometers into. As soon as I started fiddling with the wires going to the frequency potentiometers...

r4w71ZR.png

 

Yes! And fuck! I just spent several hours for something that was a simple problem with bad jumper wire contacts... Well, at least that's sorted now then. The final wiring will use KF2510-connectors & higher quality cables anyway...

So, I guess that now means that the "main" board of the analog function generator is now done. I've also received the fast op-amps I need for the square-wave output buffering & amplitude + offset -adjustments (of course I still need to build & test it). Also I need to design the front panel, and mill it. Then I'll need to program an Arduino to do the frequency measurement and switching timing capacitors + sine/triangle output. And then there's the DDS-side for the digital function generator (sine and square only, up to 70MHz, the analog one only goes up to around 480kHz). 

Also, I've got an idea how to clean up the sine-wave output (the ripple seen in the closeups) by re-buffering the output and turning the later buffer-amp into a low-pass filter (but that should only be activated for the sine-wave, not the square, as they both come through the same output, so there an optocouple becomes handy again for turning on/off the feedback capacitor).

To be continued.
 

Edited by esaj
Link to comment
Share on other sites

I think I can finally say that I am (almost, just a couple of minor details to take care of :D) happy with the square wave output. It took three prototypes and one "final" board to get it.

fGmhqbA.jpg

Prototypes, the leftmost is the "original" push/pull-based one, the middle one is the first based on fast op-amp, and the rightmost is the one based on which I made the final version. Measuring "fast" stuff (well, really not that fast, we're "only" in the nanosecond, ie billionths of a second -range ;)) with breadboard-circuits doesn't really work, as the breadboard itself will already "slow" things down and cause all sorts of noise and other problems (bad connections etc.). These will go to scrap, after I desolder anything I see still as useful (like those KF2510-connectors). Cheapskate... :P  Also destroyed two LM6172's and a LM7171 (about 2-3 euros a piece each...)  during the process  :rolleyes:  One overheated during the soldering to a SOP/DIP-adapter board (yeah, don't use 320 degrees Celsius for those :P), one I managed to place upside down in a testing setup and one overheated during usage (I suspect the reason was too high VPP in the inputs vs supply voltage, it seems to heat them up considerably, and they're not rail-to-rail devices).

This is the final design (pending minor testing and changes with the pot-values and resistors around them, but sooo near final :D):

2xs3nIc.png

EDIT: The above schematic is actually missing the capacitors. There are 470uF electrolytics between 24V and 12V, 12V and ground and 24V and ground. Next to the positive supply pin of the LM6172, there are 100nF polypropylene and 1nF monolith ceramic for filtering any noise in the supply.

I went with separate 5V -input for the base of the 2N3904 -NPN-transistor. When the open-collector output of the LM319-comparator starts to conduct, it pulls the base of the transistor to ground, at which point the voltage from the 24V (+12V "virtual rail") will go to the non-inverting input of other half of LM6172 (a high-speed dual op-amp). In the schematic, I used LM358's, so it won't work in the simulation like in real life (LM358 has a slew rate of something like a "few volts" per microseconds, whereas LM6172 can reach around 3000V / µs in optimal conditions). .

There are a bunch of diodes on both sides of the transistor to keep the input voltage above 0V and below the maximum rail voltage (as I said above, it seems that these op-amps start to heat up a lot if input voltages aren't about +-1.5V above/below the rails). It still heats up during use, but I've done a lot of testing with the prototypes and the final board, and it seems to be able to handle it.

The rest is pretty much the same set up as in the original function generator schema (mdiy.pl), except for slightly different resistor values (which I will probably still tweak a bit, but that's about it then).

I was first planning to build one more circuit on a dot matrix-board with copper foil to create ground planes, but then, I still have my friends' Proxxon-milling machine in the garage, so I decided to use copper-clad board instead, as that will allow me to leave a large ground plane on the board to minimize ground impedance/resistance and to (hopefully) block noise.

DQltKey.jpg

"Careful" planning of the board. At this point, I've already drilled the holes according to my sketch I made on top of the board  :P   What makes this a lot easier is that only the DIP-legs and the trimmer needs to be with correct hole placement, with the rest of the components I can just bend the legs around as needed.

 

BQnJqAJ.jpg

Just drew some lines to see where I need to do the milling in.

Nv6KNbF.jpg

Again didn't take any pictures of the actual milling process, but here's the end result. I still needed to add a couple of holes after this that I had forgotten (whoops, that's what you get for rushing the "design" ;)), but the milling went ok, there is a large hole next to one of the larger pads though (I moved the head downwards by accident when I was supposed to raise it :D). Not a biggie though. Never done any isolation milling before, but this was easy as it's just straight lines.

6VSVBeB.jpg

Components soldered to place. In hindsight, I should have used a slightly larger tip, I did this with the trusty ol' 1.2mm chisel.

3XBXuDJ.jpg

Component side with the connectors in place. I still might shorten some of those wires, if possible, but at least solder the wires directly into the potentiometers that will come to the faceplate of the box once I get the final resistor/potentiometer values "correct".

So how well does it work? Not bad at all, although not "perfect" either:

FsMuGOC.png

Here's the rising edge at the maximum frequency I can get out of the thing (around 470kHz), when the amplitude is adjusted with roughly 1.5k resistor in front of the 10k amplitude pot. It can still go a "bit" faster if using lower resistance there, but I don't have a suitable resistor, and 56 nanoseconds isn't a bad rise time. The slew-rate that Rigol shows is shown as volts per second (in this case, megavolts, that's millions of volts, per second). Op-amp slew-rates are marked as volts per microsecond (µs, one millionth of a second), so 1 MV/s = 1V/µs. Therefore, the slew-rate is 280V/µs here. Far cry from the 3000V/µs ideal maximum, but good enough for me.

rbhPhVp.png

The fall time is actually slower than the rrise time, but not that bad either. 63ns is still good in my books (consider that the period length here is little over 2µs, or >2000ns). Slewing at -248V/µs.

nxhaijN.png

The rise isn't exactly "totally vertical", and there's a slight dip just as the signal starts shooting up, but nothing really dramatic.

It is possible to push the chip for much higher rise times and slew rates in this setup:

nstndll.png

19.2 nanosecond risetime, 920V/µs. Actually, I've managed to push it into something like 12ns and way beyond 1000V/µs, but as this picture already shows, the signal starts overshooting and ringing (and even worse than shown here), plus the op-amp starts to heat up. I prefer not to kill anymore of those, if it can be avoided and won't try to get this high values out of it :P  The overshoot actually goes above the rail voltage (and when pushed far enough, the lowest voltage will go below ground...)

Of course probably my probes also play a role here, they're the basic passive-kind, so some of that might be just the probes themselves adding ringing/noise in the signal. I did check the compensation though, so at least they should be ok in that sense.

6e2fM78.png

Signal falling in the same setup.

In the end, I decided it's probably not worth it trying to squeeze out the last nanoseconds from the rise/fall times :P

One final shot, setting the output to a very low frequency, there is some sort of "drained capacitor" effect (but it won't begin until somewhere below 10Hz, maybe a couple of hertz):

i0GwjoR.png

 

Maybe I should have gone with 47uF bipolar instead of 33uF. But like said, this only starts to occur in very low frequencies (the above screenshot is at 578mHz, that's millihertz, ie. about 0.5Hz). Nevermind the rise/fall times showing 10ms, the way Rigol does the measuring is that the timing resolution depends on scale, and here it's 500 milliseconds / grid square. Dropping to lower scale, the actual rise/fall times are <1µs.

So, apart from the "very final" fine-tuning, the analog-side starts to be complete, now I "just" need to design the front panel, do the control software for the Arduino and play around a bit with the AD9851 (DDS-generator) to get that there too, I already did test it before and controlling it is pretty straightforward, so at least that part should be relatively easy :P

Also, I still might add that low-pass filter for the sine-wave to get rid of any extra noise, but that should also be fairly fast (a basic nth order LC-filter, probably).

Edited by esaj
  • Upvote 1
Link to comment
Share on other sites

  • 2 weeks later...

I did manage to find good values for the resistors & pot in the function generator square wave amplitude control, and get the rise times to around 40ns without any significant overshoot. And then, as usual, I got a bit derailed... :P 

I remembered I had a broken small sander (the motor broke) with lithium-battery in the garage. It has stood there for over a year, and I was pretty sure the cells must be toast by now. To my surprise, it still had a voltage of about 11.94V. I brought it inside and started taking it apart. 

k4VPu7U.jpg

Nice, there's some kind of BMS-board there. Apparently it also has balancing, as there' s "extra" wires running to the bottoms side.

jcAPkBH.jpg

I cut the wires from both ends, so I don't have anything dangling around while taking the rest apart. This feels like defusing a bomb... :D

ZvTz4wy.jpg

The tabs were soldered, but I decided to just cut them off the BMS.

tLyav5V.jpg

All of the cells were in perfect balance (well, as good as my meters can show), each at 3.98V.

B9DsFBW.jpg

After cleaning up the rest of the tabs from the cells, I placed them in 18650-holders with output wires in screw terminals to prevent any accidental short-circuits.

So, now I had cells, but these are (apparently) unprotected ones, so I need some kind of BMS. I could have of course kept the pack as-is, but what's the fun in that? ;)

I designed a simpleish circuit to handle charging & discharging of the 2S-"pack":

Dby1ctV.png

Btw, D3 is supposed to be connected to trace coming from B2 and going to D1, it's unconnected in the picture as I was testing some stuff on simulation (as well as the voltage sources using sine-functions to fluctuate). Also, the comparator is powered ONLY from the discharge side in real-life (the right-hand side of the schematic). It's a bit messy... :P

It's fairly basic in the end, TL431's are used to give (about) 2.5V reference voltages to the comparators (LM393 dual comparator in reality, but LTSpice doesn't have the model). Then, the actual charging voltage (B1) and battery voltage (B2) are divided using the resistive dividers (R7 & R8 for charging, R2 & R3 for discharging). A feedback-resistor between the non-inverting inputs and the outputs of the comparators is used to turn them into Schmitt-triggers. This is to prevent the circuit from turning on and off (oscillating) if the voltage fluctuates around the cut-off point, or if it bounces back up when the load is cut (on discharge-side). When the voltage crosses the cut-off point, the open collector-output of the comparator stops conducting and the mosfet gate pulls up to the battery voltage through R5 in charging-side and R4 in discharge side, stopping the P-channel mosfet from conducting.

Nevermind the R10 & leds & the V2/R11/Q1-stuff, I was just testing other ideas there ;) (Yes, I plan to do the night-light project again with lithium-cells, but this time with a microcontroller, now that I have lots of "extra" Pro Minis laying around).

In the end, I used 820k in real-life at the charging side (the cut-off is around 8V, so 4.0V per cell), as I didn't want to take a chance if the voltage of the cells isn't in balance (it could push the other cell into overvoltage). Other than that, the values in the schematic are what I ended up using in real life (at least on a quick glance).

Not shown in the schematic (except with comments) are the PTC-fuses I used, 1.1A for the charging side and 250mA for the discharge side. This is going to be used in fairly low current project. Calling it a "BMS" would be a bit over-the-top, because it actually has no balancing or single cell voltage monitoring, more like a simple protection circuit.

I built the thing on a breadboard, tested it, then on a dot-matrix board and tested it again (using the battery powered PSU), and finally, with the real cells:

WeISY0y.jpg

Remember what I said about working with lithium cells in cluttered area with metal objects? Don't... :P

Any way, the above image shows the discharge-side PTC-protection in action, the output is "short-circuited" (well, not really) over a 4 ohm power resistor, which should cause a current of about 1.8A (the output voltage after the diode drops was around 7.5V) to run through it. The PTC limits the current to around 250mA, and the voltage drop over the resistor is only around 1V. Still wondering if I should add real fuses there, just in case something still goes wrong... ;)

I haven't discharged the cells far enough to get the discharge-side cut-off, and haven't (yet) tested charging the actual cells through the charge-side... Will get to that eventually, once I muster up enough courage :D

I still have another battery (from an old laptop with broken motherboard) to dismantle at some point, no idea in what condition those cells are.

 

Edited by esaj
Link to comment
Share on other sites

  • 2 weeks later...

Still technical hurdles to overcome (in software, in hardware, and in encasing)... but it's slowly getting there...

NkHuYhm.jpg

 

EDIT: Of course I ran into trouble with that frequency counter... the interrupts don't seem fast enough, after 150kHz or so, it starts missing pulses, and I didn't manage to get straight EIMSK/EICRA -register fiddling and ISR to work (apparently it _could_ in theory be faster than whatever the vanilla attachInterrupt of the Arduino-libraries does). Guess I'll have to live with that for now, as I have some more pressing issues (still!) on the hardware side & making everything fit. I might have to actually make another board for the Nano (or maybe Pro Mini) due to size/fitting issues, so I could add a counter there to switch into reading frequency divided pulses above certain threshold frequencies (and add some multiplexing via some 74HC-chip, as I currently don't have but digital pins 0 & 1 and one analog pin free ;)).

Edited by esaj
Link to comment
Share on other sites

Of course my weekend was filled with everything else except working on the function generator... :P

At least I got around to improve the lighting on my workspace and tidying up a bit (for me, this is pretty tidy ;)):

gYMMqi0.jpg

The light has two one meter long led-strips (one with 240 leds / meter and other with 60 leds / meter, as I only had one meter of the 240-variety). Might add some 3W round leds I have along the light "rail". It also has dimming & bypass and separate on/off control for the two strips (hidden partially behind the PSU). Can finally get rid of that lamp stand that's on the front left of the picture, as I can actually see now :P

Likely I'll have to build some sort of rack for the bigger plastic boxes, as they take up too much deskspace. Also need to get rid of that shelf-thingie where the oscilloscope & random crap sit on, and replace it with something smaller. Got another set of drawers sitting under the desk, so I can hide more crap away from sight... Good thing, since I have some 60-odd orders coming in within about a month :D 

Also, ordered a desktop-CNC on monday (found a CNC 2418 on sale at 188€ with DHL shipping) , but they still haven't shipped it  <_<  The money's on escrow via Aliexpress, so no fear of losing it, but the order will get cancelled unless they ship it by next tuesday. I'd rather take the CNC than my money back :P

cnc-2418-diy-cnc-engraving-machine-3axis

Edited by esaj
  • Upvote 3
Link to comment
Share on other sites

I sometimes get insomnia, so I do what any normal people would do: I get up, walk to my study, go through my toybox (yes, every normal thirty-something has a box of toys in their study, don't you? Guess you're not normal then...), and pick a bunch of old Meccanos (metallic "building blocks"). Hmm, now what I could do from these? Well, like any normal person, I of course start building a robotic arm.

Couple of hours later:

LSWjvnm.jpg

Crude construction of rotation base with stepper, another stepper to turn the arm up and down, a servo to turn the grabber sideways (well, actually it would be more useful to turn it up and down too) and the grabbing part with another servo, a spring and some fishing line.

dAYKwLh.jpg

Testing the arm shows quite some problems with the joints... no surprise there, the "motor coupling", and I use the term very broadly here, is just a the axle pinched between two thin blocks and a lot of weight on top.

Z8OfMOe.jpg

After a couple of iterations, I had to remove the other servo (the plastic arm couldn't handle the weight) and add a counter weight. It's still flimsy and "collapses" easily, but hey, it sort of works:

Guess I can go to sleep now, to dream of better constructions & more torquey (is that even a word) steppers and servos... :P

Edited by esaj
  • Upvote 2
Link to comment
Share on other sites

Looks like I'll be spending half the weekend just checking that all the stuff that arrived over the week works... I did manage to squeeze in a bit of debugging stuff on the function gen, but it still remains incomplete (and I need to redesign at least the Arduino control-board due to wiring / fitting issues). But like said, I have to go through a bunch of stuff so I can confirm them as arrived & ok. Driving NEMA17's with an Arduino CNC-shield & A4988-drivers:

KpvkjE3.png

I first tested the small driver-boards one-by-one to see that they work, then installed the grbl -controller software ( https://github.com/grbl/grbl ) into an Uno and tested some example files with grblControl + manually driving the motors. Seems to work ok, at first the motors would seem to get "stuck" once reaching full speed, but it was solved by configuring the 4988's to use half-steps instead of full steps.

 

  • Upvote 2
Link to comment
Share on other sites

OMG @esaj...Sooo Impressive!! Given your multiple projects and progress I would say you sleep 1 hour max per day. You even etch your own boards! Last time I did that was 30 years ago as it turned out so ugly!!:(

On 8/4/2016 at 7:47 PM, esaj said:

Yes! And fuck! I just spent several hours for something that was a simple problem with bad jumper wire contacts.

Do moderators wash their mouths out on 4 letter words?:D 

  • Upvote 1
Link to comment
Share on other sites

1 hour ago, Rehab1 said:

OMG @esaj...Sooo Impressive!! Given your multiple projects and progress I would say you sleep 1 hour max per day.

Thanks, although most of them are either in seemingly perpetual "not complete"-stage, waiting for parts, time, energy, rework or whatever :P

About the sleeping, I wish, actually I need to sleep as much as everyone else, and as I sometimes get insomnia, it just means I have to "take it back" by sleeping more on the weekends, taking away precious time from my projects :P  Not to mention that I think I still spend far too much time just doing nothing or watching tv or whatever... "when you have the time, you don't have the energy, and vice versa".

 

1 hour ago, Rehab1 said:

You even etch your own boards! Last time I did that was 30 years ago as it turned out so ugly!!:(

If you refer to chemical etching, the few "homemade"-boards I have done have been milled with a hand-cranked milling machine of my friend. That's about to change once I get the CNC (and get around to assemble and fine-tune it so it can actually do something, and hope it's accurate enough ;)). Most of the time I just use ready-made "prototype" strip/vero/dot-matrix -boards.

I have done a few etched boards back in school a long time ago, and I was thinking of doing chemical etching, but the whole toner transfer / UV-light and ferric chloride-stuff put me off, especially since the left over chloride is basically toxic waste and needs to be disposed of properly (you can't just dump it in the sink/toilet).

 

1 hour ago, Rehab1 said:

Do moderators wash their mouths out on 4 letter words?:D 

All I can say to that, is quote the WTFPL ("Do what the fuck you want to -public license") FAQ, but don't take this personally ;) :

 

Can’t you change the wording? It’s inappropriate / childish / not corporate-compliant.

The WTFPL lets you relicense the work under any other license.

But profanity is offensive!

You know what? Fuck your stance on profanity. Fuck your priorities in life. The WTFPL is about fucking freedom and we mean it. Freedom means freedom to copy and modify and share works of art and science with the rest of mankind, but also freedom to be gay and marry and have crazy gay sex, freedom to have tattoos, freedom to say there is no God, freedom to take the pill, freedom to have an abortion. People die for being gay or atheists. Don’t tell me that there is something sacred enough that it must be protected from the mere existence of the word “fuck”. If the F in WTFPL offends you, then fuck you and your beliefs. Triple fuck you.

 

  • Upvote 1
Link to comment
Share on other sites

Wow, this is unbelievably stupid... since May of this year, DHL is charging 40€ for the documents you need to do customs clearance. If you let them do it, it's a minimum of about 25€ (or 5% of the customs duties & taxes of the parcel, but at least around 25€ if the 5% would be less than that). :D

Tullivakuuspalkkio Per lähetys 5 % verojen arvosta, min. 20.00 EUR per lähetys

That's without VAT (so the minimum total is 20€ * 1.24 = 24.80€)

 

Luovutus Per lähetys 40.00 EUR

Tulliselvitykseen tarvittavien luovutusasiapapereiden valmistelu ja toimittaminen lähettäjän tai vastaanottajan pyynnöstä. Tästä toimenpiteestä DHL veloittaa luovutusmaksun. DHL ei vastaa vastaanottajan tai muun osapuolen suorittamista tullaustoimenpiteistä mukaan lukien niihin liittyvät viiveet.

Google translate:  Preparation and submission of the request of the sender or recipient of transfer of the documents required for customs clearance. For this measure, DHL will charge the transfer fee. DHL is not responsible for the recipient or any other party carrying out customs measures including the related delays.

 

So really no point in doing the clearance myself, as it would cost more... More about this change (in Finnish):

http://yle.fi/aihe/artikkeli/2016/04/12/miksi-dhln-viestissa-ei-kerrota-etta-asiakas-voi-tehda-tullauksen-itse-maksutta

Notice the part "LISÄYS: DHL muutti itsetullauksen maksulliseksi toukokuussa 2016"  (rough translation in English: "ADDENDUM: DHL has changed doing custom clearing by yourself to carry charges since May 2016")

On the bright side, I might actually get the CNC within a week (already enroute from Hong Kong, currently in Germany).

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...