Sunday, August 24, 2014

DIY-ing a function generator

It's holiday time! Irene is running with her friends, Elise is making things out of Fimo clay, Gijs is enjoying just pottering around, and me - I'm that old geezer who has found himself a hobby.  Electronics, in my case. This post is about me making a function generator out of a few electronic components and an old sweets box - something I'm insanely proud of despite the fact that (a) any reasonable DIY-er can do it, and (b) I'm sure there are many web pages that will tell you how to do it - and probably much better than I have done.

A function generator is a little device that generates square, triangle, and sinusoid waves, of 'arbitrary' frequency. The heart of this device is the Exar XR2206CP, a 16-pin IC that most sellers consider 'obsolete', but that one can still get on ebay and such. With this IC the actual production of the three different waves is done for you - you 'only' need to connect up the right collection of resistors, capacitors, and switches, as shown by this schematic:

(for some explanation, see below)
Part of the fun is the challenge to get it into a nice little box. Irene gave me a little box of Vermint's Organic Mints, and I decided to try and fit everything into it. In the end all did fit in, but only just. Here's the finished product:




After having worked out the schematic above, I ordered the missing components at farnell. I was a little taken aback that the two potentiometers - the big round things, like volume knobs - were so big that there was very little space left for the rest of the components.

The rest of the components all had to go on a piece of stripboard, which is a flat piece of fiberglass-epoxy with holes predrilled and one side covered with copper strips. I use the 'tripad' variety, with strips three holes long. Because of the little space left by the potentiometers I did my best to optimize for space, leading to the schematic below. You can recognize the 2206 chip in the middle, and the copper strips in groups of three (indicated by ovals). I managed to keep the whole thing no wider than 8 holes, which is the length of the IC. But that did mean that everything got bunched up, nothing like the clean spacious designs one finds on electronics websites :-)


Soldering is not my strong point, but in the end I managed to get everything in place. Then came the issue of assembling everything in the box. I found that one of the hardest parts was actually drilling nice round holes - for some reason, that I don't really understand, I often get asymmetric holes (like the last picture in this page; maybe one day I'll try that suggestion, to drill through some cloth). But finally everything was done, and the whole set fit into the box.

Here are some of the ouput plots, such as a sine wave,

a triangle wave,
and a square wave:
This all works as it should. (A big thanks to Merijn Wijnen for letting me use his oscilloscope!)

The frequency range is supposed to go up to 1MHz; I pushed things slightly further by using a smaller capacitor, and indeed the frequency can go up to 4MHz, but then the square wave does not look very square any more:
The sine wave is not too bad at 4MHz,
but the triangle wave doesn't look right either;


With this sub-spec capacitor it also turns out that the frequency is not exactly constant. Here you can see how the later waves come in at different times: while the lines are clean on the left-hand side, just after the trigger (as they are automatically since the scope triggers on them), towards the right one can see multiple versions of the waves, at slightly different times.
And to make things worse, if I touch the box somewhere, then this frequency shifting becomes much stronger:
I don't yet understand exactly what causes this phenomenon.

Concluding, this was a very nice little project with some good challenges (at least for me) along the way: designing, optimizing, soldering, drilling - and with a nice function generator as a tool at the end!


Comments on the circuit schematic:


The 2206 outputs a square wave on pin 11 (provided one adds a pull-up resistor) and a triangle or sine wave on pin 2; the choice between triangle and sine is made by the switch between pins 13 and 14 (the bottom switch in the box, with the blue body). The frequency is set by the components on pins 5, 6, and 8; the capacitor between 5 and 6 charges and discharges through the resistor at 8, and therefore the frequency of the output is roughly equal to RC. I put in three capacitors, of 100 pF, 10 nF, and 1 uF, which are switched through the top switch (with the red body); the resistor is variable (the right potentiometer). This gives me three ranges swept by the potentiometer, starting somewhere below 1 Hz, and ending at the 4 MHz that I showed above.

The funny arrangement at pin 3 determines the amplitude of the wave; when pin 3 is at exactly one-half Vcc the amplitude is zero; the variable resistor modifies the voltage at pin 3. 

There are two trimmer resistors (at pins 15-16 and 13-14) which can be used to slightly modify the form of the sine wave. I chose an intermediate frequency and twiddled them until the FFT of the sine wave had the least overtones. 

Finally there are a number of 1 uF capacitors sprinkled around to prevent cross-talk between different bits of the circuit.

Wednesday, August 06, 2014

Hoe plakt bandenplak het best?






Net als de meeste Nederlanders heb ik de kunst van het bandenplakken via-via opgedaan - van mijn vader, van vrienden, en van toevallige bijstaanders met commentaar op mijn techniek. De laatste paar keren wringt het een beetje: ik heb niet het gevoel dat ik echt goed snap wat ik aan het doen ben.

Om maar iets te noemen: hoe lang laat je de lijm drogen voordat je de plakker erop doet? Moet het nog nat zijn, of juist niet? Ik heb 'tien minuten' gelezen op fiets.nl, maar ook 'zeker drie minuten' of zelfs niets. Wat gebeurt er precies tussen band, lijm, en plakkertje? Ik heb het gevoel dat het oranje materiaal aan de plakkant van het plakkertje belangrijk is, maar ik weet niet precies hoe. De lijm wordt vaak solutie genoemd, wat een vorm van oplossen suggereert, maar wat gebeurt er precies? Ik weet het niet, en werd van het internet ook niet wijzer.

Dus werd het tijd voor experimenten. Irene heeft op mijn verzoek een fietsenmaker lief aangekeken en een oude binnenband geregeld: genoeg materiaal dus. Vandaag: wat voor lijmprotocol zorgt voor de beste hechting?



Experiment 1: vijf verschillende droogtijden, van 0 tot 180 seconden (toen had ik de 'tien minuten' nog niet gelezen). Verdere details: ik heb de plekken opgeschuurd en met keukenpapier schoongeveegd; geen verdere ontvetting. De lijm (Simson, nieuw gekocht) heb ik met de spuitmond van de tube zo goed mogelijk dun uitgesmeerd. De plakkers waren ronde stukken geknipt uit Simsonvellen. Dit zijn de bevindingen:  
  • Ik heb gekeken of de oranje laag goed is uitgelopen en aan de band bleef hangen, wanneer je aan de plakker trekt. Dit lijkt goed te werken zolang de lijm er droog uitziet wanneer je het plakkertje erop doet; dat was het geval bij 60 seconden of meer wachttijd.
  • Ik heb na tien minuten gekeken hoe makkelijk de plakkers eraf te trekken waren. Dat viel me tegen - alle vijf waren zonder probleem eraf te halen, en ik merkte geen verschil tussen de vijf. 
Ik was verbaasd dat alle plakkers er zo makkelijk vanaf kwamen. Dat leek me niet goed (maar zie hieronder). Experiment 2 was daarom om vier verschillende schoonmaakmethoden te vergelijken: alleen schuren, schuren en afvegen (hetzelfde als Experiment 1), schuren en met spiritus afvegen, en schuren en met terpentine afvegen (ik realiseer me nu dat ik ook 'niets doen' als protocol had moeten proberen - wijsheid achteraf). Verder 60 seconden droogtijd.
  • De band ziet er verschillend uit na de vier behandelingen: afvegen na schuren geeft uiteraard een gladder oppervlak, maar terpentine lijkt de band enigszins op te lossen - er blijft een zwart residu achter op het keukenpapiertje, en de band blijft donker zwart achter. 
  • De vraag was of er verschil in hechting was tussen de schoonmaakvormen. Dat was er zeker: bij spiritus en terpentine moest ik meer kracht gebruiken om de plakker eraf te trekken, en bleef er meer plakresidu (en zelfs wat oranje materiaal) achter op de band. 
Zelfs bij terpentine en spiritus vond ik de hechting nog onder de maat, maar ik begon me nu wel afte vragen of mijn inschatting van hechtingskwaliteit wel goed was. (Antwoord: ik weet het nog steeds niet). De verdere experimenten hadden allemaal als doel om andere variabelen te proberen.

Experiment 3: Variabele droogtijd, van nul tot 120 minuten; schuren, terpentine, 60 seconden droogtijd. Resultaat: geen enkel verschil.

Experiment 4: De lijmvrije pleisters 'BBB Leakfix': deze plak je direct op de geschuurde band, zonder lijm. Resultaat: er is een vergelijkbare laag als de oranje laag van Simson (maar zwart), die ook zacht wordt en hecht; maar de plakker is er net zo makkelijk vanaf te trekken.



Experiment 5: De voorverpakte plakkers van Simson, met een aflopende oranje laag. Verder terpentine, 60 seconden. Resultaat: geen verschil, al moest ik de band plus plakker doorknippen om goed aan de plakker te kunnen trekken: de gladde aansluiting zorgt wel voor verminderde 'pulk'-mogelijkheden, wat waarschijnlijk goed is.

Experiment 6: Iemand suggereerde om honderd hamerslagen op de plakker te geven (het argument is dat vulcanisatie een fysico-chemico-mechanisch proces is, dat het beter doet bij mechanische manipulatie en hogere temperatuur, en hamerslagen helpen bij beide). Daarom: twee plakkers, één met honderd hamerslagen, de ander zonder, verder hetzelfde protocol. Resultaat: geen verschil.

Experiment 7: Is temperatuur dan belangrijk? Meteen na plakken 20 minuten op 160 graden Celcius. Resultaat: dit was de best vastzittende plakker van allemaal. Nog steeds was het eraf te halen, maar het koste deze keer echt moeite.

Conclusie: Wat hebben we hiervan geleerd?
  • Misschien is het niet zo erg dat je een plakkertje er makkelijk af kunt trekken wanneer hij net geplakt is; misschien verandert dat namelijk over de dagen en weken erna, mogelijk ook vanwege de mechanische belasting in het wiel.
  • De volgende keer dat ik een bestaande binnenband met plakkers buiten de velg heb, zal ik kijken of die (oude) plakkers er niet zo makkelijk vanaf komen. 
  • Hoe zouden we de theorie van het langzaam verder 'garen' kunnen testen? Sommige van onze fietsen hebben een erg makkelijk demonteerbaar voorwiel. Misschien een keer een serie plakkers op plakken, en ze dan één voor één over de weken eraf trekken ... ?