[R2] OpenGen – OSHW handheld waveform generator - Page 1
Forum section: electronics / projects

author: microbug
author_rank: Frequent Contributor
timestamp: August 01, 2014, 05:47:10 pm
content: EDIT: See the R2 schematic which is on page 2 for the newer version.I have attached the Rev 0.1 schematic for my handheld waveform generator design (OpenGen on Hackaday Projects). It is supposed to generate any signal from around 2kHz to 42.5MHz, and is based on the common AD9850 modules available on eBay. I would welcome any constructive feedback on the design. I have not yet designed a PCB as there are still a few things I need to implement (physical switches controlling the outputs).Note that the +13V boost regulator is currently 'broken'; the peak switching current would be more than the MC34063 can handle so I plan to implement either another chip or an external switch.Some questions I have in mind:I already have separate digital and analog supplies, but should I have separate grounds? The finished design will likely be on a 2-layer PCB with a flood-fill ground.In terms of efficiency would it be better to power the -13V rail from the +13V or the battery (8.4V to 6V)?Should I power the DAC from the digital or the analog supply?Do you think the THS6022 will manage the maximum of a 20V pk-pk sine wave at 42MHz? The datasheet says that it won't at full load (200mA), but although the output does have a 50ohm impedance, I won't be using it with a 50ohm terminator.If you like it, please give it a skull on theHackaday project pageas I have entered it for the Hackaday Prize! You can find a link to the KiCad design files there too.This whole project is Public Domain.~microbug

author: rob77
author_rank: Super Contributor
timestamp: August 01, 2014, 06:08:39 pm
content: glad to see my keypad suggestion in the final design !regarding the DAC, i would probably think of a different solution.you have A0-A3 unused - those pins do have digital circuitry - so i would use those for the AD9850 and free up some PWM capable pins and simply omit the DAC and use the PWM outputs with low-pass filters instead of the DAC - 8 bit resolution should be enough to control the amplitude, DC offset and duty cycle.

author: microbug
author_rank: Frequent Contributor
timestamp: August 01, 2014, 06:12:07 pm
content: I didn't know that A0-3 had digital circuitry too. The question, however, is whether one can use it on the Arduino platform. If it's too much hassle, I might just stick with the DAC- it does have higher resolution and is very cheap.

author: c4757p
author_rank: Super Contributor
timestamp: August 01, 2014, 06:16:44 pm
content: Looks like you're off to a good start. I'd make a couple suggestions:First: Dude. Pages. Your schematic is very hard to follow. You can make a hierarchical schematic with multiple pages andactually draw the signal path between them.The THS6022 is expensive, and it's a dual package with decent power handling. Don't chain them - you're wasting the capacity of the first one. Parallel them instead (each with its own 100 ohm resistor to the output rather than a single 50 ohm termination), which will be much easier on them thermally. If you still need another amplifier for voltage gain, use a cheaper one. I'm not sure about it achieving 20V p-p at 45 MHz**. That's not a trivial task, but it's a pretty good amplifier. I'd just say you should get one and try.If I were you, I'd be looking into building this on a four-layer PCB. They've become quite affordable lately, and if you want good signal integrity, the good, solid grounding will be a good friend. Power distribution will be much easier too. You could definitely do this on a double-layer board, but I wouldn't find it worth the effort.As for powering the -13V rail: it's usually going to be less efficient to chain power supplies. However, if you want to support a wide range of input voltages (yes, a discharging battery can count), it could be easier to design justonewide-range DC-DC converter, and then power the rest off the fixed output of that. Your choice.Quick warning: Watch out, you've got the same pin numbers for both halves of the THS6022.**Edit: Yeah, it won't do it. Slew rate is 1900V/µs. The maximum slew rate of a 45 MHz signal at 20 Vp-p is (20/2)*2*pi*(45 MHz) = 2800V/µs. You could get 20Vp-p up to almost 30 MHz though, and maybe just drop off the maximum amplitude to 10Vp-p at 45 MHz. I doubt you'd need such a large amplitude at such a high frequency.

author: nuno
author_rank: Frequent Contributor
timestamp: August 01, 2014, 06:24:16 pm
content: I think some 16x2 LCDs do not have current limiting resistors on the backlight, so it wouldn't hurt to add one, even if it ends up at 0 Ohm.You could take a look athttp://www.cypress.com/?rID=92146. It's way cheaper, faster, the core chip has more functionality (including programmable digital and analog blocks, 2 low-res IDACs etc) and has a *much* better IDE (I would say state-of-the-art) than an arduino.

author: rob77
author_rank: Super Contributor
timestamp: August 01, 2014, 06:27:00 pm
content: Quote from: microbug on August 01, 2014, 06:12:07 pmyou can use them as any other pins marked as digital pins on arduino - just use the "A0" instead in the digitalwrite or pinmode functions.it's only the A6 & A7 which are connected to the ADC mux only without digital circuitry inside the atmega chip.and probably it would make sense to use a LDO regulator for the 5V - it would solve the over-current issue for the +13V boost with 34063 and you should have similar losses with the LDO as with the double conversion battery->boost->buck . if the battery is a 2 cell then you will have something between 5,4V to 6V (empty) and approx 8V(fully charged), so even a battery close to empty will have enough voltage for the LDO to make the 5V rail.

author: microbug
author_rank: Frequent Contributor
timestamp: August 01, 2014, 08:09:22 pm
content: OK- looks like it's time for rev 0.2!

author: microbug
author_rank: Frequent Contributor
timestamp: August 01, 2014, 09:22:05 pm
content: @c4757p:I'll have a go at a hierarchal schematic. This is my first project of this size and my first time using KiCad, so I'll have to look into the details.With regards to the output voltage, I did think it might not be possible. I'll figure out a more accurate spec later. In the finished design, the user will input frequency before any other parameter, so I might be able to calculate approximate maximum amplitude and adjust the settings in software (i.e., not allowing the user to enter more than the maximum amplitude).I wondered about a four layer PCB before, although it's still a while off. I will probably go for it and try to have a minimal board area to reduce cost. The fact that all my parts are surface mount (and a couple are in tiny leadless packages) will probably help with that. Alternatively, there could be a multi-board construction with the complex analog stuff on a very small 4 layer PCB. I haven't thought much about it yet.Thanks for letting me know about that. I may switch to different DC-DC converter chips for the 13V rails; the peak currents are too much for the MC34063 when they are running off the battery.Thanks for the heads up!@nuno:I'll add a current limiting resistor then.That board does look interesting at first glance. I don't have much time now but I'll look into it- thanks! As a side note, it's not cheaper than a clone Arduino Pro Mini - I got 10 on Aliexpress for $22 with free shipping.@rob77:That's useful to know, even if I end up not using the Arduino Pro Mini clone in the final design.That does make sense; I'll go with it. I'm already using a low noise LDO for the analog 5V, so I'll just find another (cheaper / noisier) one for the digital.

author: microbug
author_rank: Frequent Contributor
timestamp: August 01, 2014, 09:36:38 pm
content: Since I'm redesigning this fairly drastically now already, should I add in digital / analog grounds while I'm at it?

author: tom66
author_rank: Super Contributor
timestamp: August 01, 2014, 09:37:43 pm
content: Don't use the MC34063A please. It's terribly inefficient, has high quiescent current and its switching frequency is not deterministic, which makes filtering output ripple very difficult, this will add noise to your output. Instead use something like LT3471 for dual plus/minus, or another boost chip which has a fixed frequency mode, like LT1306.

author: microbug
author_rank: Frequent Contributor
timestamp: August 01, 2014, 09:42:29 pm
content: The LT3471 looks very nice for my 12V rails; pain that it is in a DFN! A few of the components in this are of a similar nature, so I suppose I'll get a stencil or just do it all with a syringe, solder paste and my hot air gun. I might have a look to see if there is anything in a more manageable package though...EDIT: If you haven't already worked it out (I'll forgive you based on the state of my schematic) I plan to power down the analog circuitry when it is not being used (i.e., during parameter entry) as it consumes the majority of the power in this thing. The ADL5931 has a 130mA quiescent current but unfortunately it is the only chip that will do the job. Therefore, I'm using regulators / DC-DC converters with a 'soft start' function to let the MCU bring the power on when needed.EDIT 2: It's proving very easy to find some suitable chips using the design tools on the LT website (I'll try a couple of other websites too).

author: tom66
author_rank: Super Contributor
timestamp: August 01, 2014, 10:06:01 pm
content: If rail regulation isn't critical and you can guarantee similar loads on both rails, consider using a charge-pump to generate the negative rail from the positive switching voltage. Here's one I designed into another product, it requires 5V @ 800mA and an auxiliary negative voltage at about 75mA. The negative voltage is generated using a charge-pump with the AC source coming from the switching node of the buck converter. This produces approx -11V which is then regulated to -5V using a normal linear regulator. It will also work with a boost converter, the output voltage will be approx Vswpeak-1.5V, which for a 13V boost will be about -12V varying with load current. Only thing to be aware of is you need load on the positive rail to keep the negative in regulation. If your ADL5931 is on whenever the negative rail is needed that's fine, as the 130mA will be more than sufficient. Size the coupling capacitor to set the impedance at Fsw to 1/5 or lower than the expected load impedance.

author: microbug
author_rank: Frequent Contributor
timestamp: August 01, 2014, 10:08:57 pm
content: The loads could be very different; up to 225mA on 12V with nothing on -12V. I'm not sure that this will work under these circumstances! I'm currently playing with TI's WEBENCH for some solutions.

author: tom66
author_rank: Super Contributor
timestamp: August 01, 2014, 10:11:01 pm
content: Is that for very low frequencies? That circuit really does require approx equal loads to work. LT3471 is ideal in that it regulates both loads independently, and is an integrated solution. I really liked the performance I got out of it. It will do well beyond what the datasheet says. I got 500mA out on two 6V channels from 3V in.

author: microbug
author_rank: Frequent Contributor
timestamp: August 01, 2014, 10:14:03 pm
content: The output has a user-adjustable amplitude of up to 10V (AC) and an adjustable DC offset of up to 10V, although not both at once. Nevertheless, it is quite possible that the positive rail will be doing all the work.EDIT: RE the LT3471- £5.69 seems like a lot for a DC-DC converter IC! Nice as it would be, it is also DFN so I'll find something else. WEBENCH has given me a design using the LMR62014 for the 12V rail, and I'm working through the other rails.

author: microbug
author_rank: Frequent Contributor
timestamp: August 01, 2014, 10:30:58 pm
content: What about analog / digital grounds? Should I bother?

author: tom66
author_rank: Super Contributor
timestamp: August 01, 2014, 10:45:07 pm
content: LT sure is pricey! However in all my research I never came across an IC with similar capabilities. If you've space, design in two ICs.

author: microbug
author_rank: Frequent Contributor
timestamp: August 01, 2014, 10:46:43 pm
content: Although it's early on, I am thinking of doing some of the simpler stuff (including power supplies) on a cheaper 2-layer board. This would give me more space for this sort of stuff.

author: tom66
author_rank: Super Contributor
timestamp: August 01, 2014, 10:48:50 pm
content: Quote from: microbug on August 01, 2014, 10:30:58 pmIf you want anyone to use it, yes! Make sure also to keep the switcher on its own ground, that's going to be the worst offender. Exact technique varies but it is good practice to tie your signal ground to only one point such as the negative of the output capacitors. Try to design both switchers so the capacitor grounds meet. Also, keep switching currents well away from sensitive traces and use shielded inductors for the switchers.

author: microbug
author_rank: Frequent Contributor
timestamp: August 01, 2014, 11:11:29 pm
content: OK, having looked into other solutions which are equally expensive and take up more space, I might as well go for the LT3471.

author: nuno
author_rank: Frequent Contributor
timestamp: August 02, 2014, 04:01:34 am
content: Quote from: microbug on August 01, 2014, 09:22:05 pmNo USB interface.

author: microbug
author_rank: Frequent Contributor
timestamp: August 02, 2014, 01:55:57 pm
content: Ok, I think I will go with the PSoC because of the large number of IO (allows me to program the AD9850 in parallel to get faster update when doing a frequency sweep) and the increased speed. It's impressive how cheap those chips (and dev boards) are for the functionality! Thanks for pointing them out.

author: microbug
author_rank: Frequent Contributor
timestamp: August 04, 2014, 06:07:00 pm
content: Rev 2 is now well underway. I have another question: should the high speed (square wave output) comparator be connected to DGND or AGND? It would be easier for it to be on AGND because then I only need to have AGND on the board-to-board interconnect (there will be one very small (cheap) analog 4-layer board and one larger 2-layer board with digital stuff and peripherals), but I am concerned about the possibility that it will disturb the analog stuff. The comparator does need to be on the analog board because it takes the output from the sine AGC circuit which I don't want to route across the interconnect. It will be well decoupled (something like 100pF ceramic, 100nF ceramic, 10uF tantalum).

author: nightmechanic
author_rank: Contributor
timestamp: August 04, 2014, 08:24:45 pm
content: Hi,Thanks for sharing!I have some questions / comments if it is ok: (excuse me of those were raised before - I did not find them)1. I could not find a battery voltage monitor / connection to enable a monitor (e.g. to the micro controller) I would consider adding it as it is a Li-Ion battery (that may or may not have over-discharge protection). you can indicate it on your LCD and shut down the analog circuitry etc.2. what is the reason for not having a power (on/off) switch?3.It seems that you are connecting the USB's VBUS directly to the 5V switcher output, why is that? I think that when both the battery and the USB are connected, you may have a lot of (unnecessary...) current flowing there.4. Relating to the above I would recommend using the "self powered" configuration of the FTDI and avoiding the VBUS, that is unless you want to be able to program the MCU when the battery is low/missing, if this is the case, then you should consider series diodes etc.5. Why are you feeding the 5V dig switcher form the 13V one? are you concerned of dropout voltage? how low do you want your battery to go? (see item 1) I think you can find a switcher that can be used directly from +BATT (e.g. TPS62173) so you can win back some efficiency and relax the requirements of the +13V switcher6. I am concerned that your sine wave output switch (TS5A4624) will not be able to handle your output swing, it is rated from 0V to V+ (5V) am I missing something? (are you changing it to a mechanical switch?)6.a. if you want to stay with the MC34063 for the 5V I think you need to change its connection topology - it seems to me it is in step-up (boost) topology rather than a step-down one (?)I hope this may help a little (at least help me understand your design better!)Ran

author: microbug
author_rank: Frequent Contributor
timestamp: August 04, 2014, 08:32:16 pm
content: 1: Yes, I do need to add something like that. I'll wire the battery divided by two to a spare ADC pin.2: I forgot!3 & 4: I just copied the FTDI configuration from the Arduino Pro Mini FTDI board schematic which may be best suited for a slightly different scenario. If the 5V line and VBUS are at the same voltage I do not see how current will be going anywhere!5 & 6a: I'm no longer using the MC34063 due to efficiency problems (I'll post the R2 schematic in a few days).6: Well spotted! I'll change it to a latching relay.Thanks for helping!

author: Precipice
author_rank: Frequent Contributor
timestamp: August 04, 2014, 08:37:34 pm
content: Quote from: microbug on August 04, 2014, 08:32:16 pmDon't forget that'll flatten your battery!(gate the battery voltage before the divider with a P-FET)

author: microbug
author_rank: Frequent Contributor
timestamp: August 04, 2014, 08:39:05 pm
content: OK, I will. That hadn't crossed my mind, good thinking.

author: nightmechanic
author_rank: Contributor
timestamp: August 04, 2014, 08:41:45 pm
content: I do not see how you can guarantee that your 5V switcher and VBUS are exactly the same voltage.The USB voltage is guaranteed to be (as far as I remember) 5V+/- 5% which is a range of 4.75 to 5.25V. think about a case where your switcher is set to exactly 5V and the PC is 4.9V this 0.1V will cause significant current (I would imagine this is a low resistance path) between the switcher trying to get the voltage back up to 5V and the PC loading it ...Ran

author: microbug
author_rank: Frequent Contributor
timestamp: August 04, 2014, 08:43:12 pm
content: The easy solution to that is a fairly high value resistor between VBUS and 5V. VBUS only exists as a reference in this case.I'll see if there is a more elegant solution.

author: nightmechanic
author_rank: Contributor
timestamp: August 04, 2014, 08:45:17 pm
content: what are you using VBUS for?As far as I know the FTDI board (e.g. from sparkfun) is also a bus powered design. If you do not intend to use USB power, I would recommend that you take a look at the FTDI datasheet figure 6.2 - "self powered configuration" where VBUS is only used as an indication to the FTDI.Ran

author: microbug
author_rank: Frequent Contributor
timestamp: August 04, 2014, 08:46:36 pm
content: Come to think about it, nothing. The circuit will be powered when communicating over USB anyway, so I don't need it. I'll disconnect it.

author: microbug
author_rank: Frequent Contributor
timestamp: August 18, 2014, 09:00:33 pm
content: R2 is here (schematic attached)!Changelog:Disconnected VBUS from 5V.Added battery protection (2xBQ29700) and power switch.Changed output amplifier configuration.Redrew schematic to use hierarchical sheets. While it's still not as good as it could be, it should be readable now.Recalculated some resistor dividers on the analog board which were wrong.Added test points.Completely changed power supply (see schematic for details). No longer using MC34063.Added battery monitor connection to MCU.Added ATtiny2313A. Its sole job is to program the AD9850 very fast during frequency sweep mode.To do:Add output enable switches and relays.Add hardware OR gate to control ANALOG_ENABLE.Add various indicator LEDs.Feedback greatly appreciated!

author: microbug
author_rank: Frequent Contributor
timestamp: August 19, 2014, 09:04:37 pm
content: Bump.Any feedback would be great; if it looks fine just say so!

author: bance
author_rank: Contributor
timestamp: August 20, 2014, 11:39:42 pm
content: Hey Richard,I have a few questions for you, I was looking for a solution as to an output stage for one of those DDS modules pretty much around the time of your other post... something like "wide bandwidth variable gain amp."Anyway I tried various configurations without much luck, and as soon as I read that thread I realised that an AGC was the solution.I tried a couple of those too, but most circuits I found were designed for audio bandwidth and didn't behave at all well, at higher frequencies. So I have ordered a few ad603 ICs.Have you prototyped this project yet? Does it work on a breadboard? Or should I look towards dead-bug/Manhatten style?What is the advantage of using the analogue multiplier for the variable amplitude as opposed to a simple voltage divider?What were the parameters that led you to choosing the op-amps for the final pre-amp/power amp stages?I know that's a lot of questions, and some of the answers may seem obvious but I'm a bit of a noob... so humour me if you can!Thanks Steve.

author: microbug
author_rank: Frequent Contributor
timestamp: August 21, 2014, 07:46:22 am
content: I'm happy to answer your questions! They're quite valid.I haven't yet prototyped this yet, but if you plan to use it at high frequencies (<10MHz), dead bug is the way to go. There is parasitic capacitance between the metal strips of the breadboard that would mess up your prototype.I did look into a few options before choosing a multiplier. It basically comes down to bandwidth again:- Digital potentiometers don't have high enough bandwidth (signals at high frequencies get attenuated). I assume this is what you meant by a voltage divider as the point of the amplitude control is to allow variable amplitude.- Varying the gain on an op-amp drastically changed its frequency response, and gains above 2 or so will cut back the frequency response a lot.- Programmable gain amplifiers (often used in RF circuits) are few and far between and most of them weren't suitable.The op-amps were mainly chosen for speed and slew rate. I was originally going to use the THS6022, but it's slew rate would not have let me output a 40MHz signal at +/- 10V. The slew rates had to be over 2800V/us (c475p calculated that) so I went for well over that to be on the safe side. The fairly high frequency also cut down my options more that I had thought it would; when you have a gain of 5 there are very few, if any, op-amps with a high enough slew rate. This is why I went for a dual configuration with 2 op-amps daisy-chained; they would each have a lower gain which gave me more options. I chose the THS3001 (the first one) partly because I already had oneand mostly because it has an excellent frequency response which is well documented. I chose the ThS3095 because it also has a good frequency response and can easily supply the required 200mA (10V, 50 ohm load). The resistors for them were chosen by looking I. The datasheets, which recommended specific values for certain gains to get the optimum frequency response.I wouldn't describe myself as an analog person either!~Richard