Free Energy | searching for free energy and discussing free energy

Availbale Products, Material- and Service suppliers => Do It Yourself => Topic started by: Yucca on September 26, 2008, 11:18:09 PM

Title: Open Source 3 Channel Frequency Generator
Post by: Yucca on September 26, 2008, 11:18:09 PM
Hello All,

I blew my lab budget this year on a second hand Tektronix 2431L Digital Storage Scope. And I now want/need a signal generator or 3 so I've decided to build my own.

The current secifications for the unit are as follows:

1 channel DC ... 1MHz with variable PWM.
2 channels 10kHz ... 133MHz Square waves using programmable DS1085 oscillators.
Unit actually gates external supply voltages, you feed your lab PSU in and it gets gated.
The unit is all controlled by one knob, it's a jogwheel with push and click.
All controlled by Freeduino board.

This thread will document my progress. I will post photos and descriptions in seperate posts because sometimes I lose what I'm writing when the browser hangs on me and it wastes my time.

Below is a picture of the prototype unit so far.

Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on September 26, 2008, 11:21:49 PM
I'm housing it in an old computer power supply box.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on September 26, 2008, 11:24:23 PM
Inside the box so far. Note the mains conditioner and switch is retained from the PSU. I will feed this into an old nokia phone charger, it's a nice little switch mode 5v supply, you can see it at the back right. At the front you can see my 3 board controller stack, microcontroller board at the back, custom board in the middle and LCD board at the front.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on September 26, 2008, 11:26:53 PM
These are four DS105 programmable frequency generator chips that I got for free by requesting a sample from Maxim. They are in SOIC package and I had to solder them onto DIL adapters to make them more manageable. The caps are two stage decoupling across +V and GND.

I will only be using 2 of these in this unit but you could add another board to the controller stack and put another 2 in because I've written the software so that you can change the number of oscillators in the system just by changing one line in the code.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on September 26, 2008, 11:31:32 PM
Heres the middle custom board for holding the oscillators and FET drivers. The piezo gives audio feedback for the GUI and also plays a little tune on bootup. I've got quite a bit more work to do on this board yet.

These controller boards are called "shields" in the world of Arduino/Freeduino. This shield has vero strip like connectors underneath and allows the experimenter to populate with whatever. All shields stack on top of one another and all the microcontroller signal lines are available to every shield. It's a nice flexible system for building things with.

Freeduino boards can be purchased at http://www.nuelectronics.com

The development environment for freeduino is completely free to download, just write you program in C or C++ and then download it to the freeduino board using a normal USB cable on your PC.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on September 26, 2008, 11:37:49 PM
Here's the current bezel artwork. I just print it onto paper and then sandwich it between the case and a piece of acrylic. I have a high res image and when it's finished and stable I'll ZIP it and attach it to this thread.

Note that the bezel says max frequency is 40MHz, because my FET drivers (UCC27322) will only go up that high. But the core of the unit, the programmable oscillators are good for up to 133MHz.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on September 26, 2008, 11:47:59 PM
Will post source code here as a saved txt file soon

Shame this forum hade the CODE tags removed, load of characters got converted into unknowns and even a smilie ;) appeared in it halfway. No wonder people were unable to compile LOL.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on September 27, 2008, 12:01:44 AM
.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on September 27, 2008, 12:33:06 AM
I forgot to mention in the first post, If anyone wants to build one of these for their own home lab then I'll be more than happy to help them do it, the total cost of the project is probably going to come in below €100.

The only difficult part to source is the jog wheel, but a jog wheel is not necessary because I've written into the code the ability to use the 5 mini push buttons that are already included on the LCD board from nuelectronics:

http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=1&products_id=2

(http://www.nuelectronics.com/estore/images/nustore/lcd_shield.jpg)
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on September 28, 2008, 12:56:00 PM
I will also post a youtube video of the user interface in action sometime showing how you can select which decade to adjust and then just sweep through that decade and how you can select which oscillaotr to adjust and adjust PWM.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on September 28, 2008, 02:54:34 PM
A short youtube video of the unit in action, a bit blurry because it's shot with a USB webcam:

http://www.youtube.com/watch?v=XXJbskeYq-s
Title: Re: Open Source 3 Channel Frequency Generator
Post by: z.monkey on September 28, 2008, 03:04:31 PM
Howdy Yucca,

Cool!  DIY Freq generator.  My favorite kind of project.  So you get to hardware, software and mechanical.  Are you doing any PCB designs or are you using protoboards?  I build test equipment at work on a as needed basis.  I usually don't put it in a pretty box like you have.  Mine get mounted on a chunk of wood (don't have the budget for pretty boxes). 

Have fun!

Blessed Be...
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on September 28, 2008, 03:21:48 PM
Howdy Yucca,

Cool!  DIY Freq generator.  My favorite kind of project.  So you get to hardware, software and mechanical.  Are you doing any PCB designs or are you using protoboards?  I build test equipment at work on a as needed basis.  I usually don't put it in a pretty box like you have.  Mine get mounted on a chunk of wood (don't have the budget for pretty boxes). 

Have fun!

Blessed Be...

Hi Z.Monkey,

Yep, as you well know it is good fun to realise your ideas. Software's my favourite bit of it all, I'm not doing any PCB design on this project, I'll be using proto board and flyleads to the FETs. The pretty box was zero cost, old salvaged computer PSU steel case with acrylic bezel salvaged from a broken shop sign discarded on the street. I don't think it'll look as cool as your infinity coil though ;).

Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on October 03, 2008, 12:04:28 AM
I've got the FETs working OK now, the FET drivers make it all very easy, you just hook them straight up to the gate. I'll be changing the FETs to P-Channel, which will reduce my max freq. down to ~20MHz, still fast enough for me though.

Cascading will be possible with the unit for gated waveforms.

I will also be adding two BNC ports to the back that will accept analog (0...5v) signals, these will go through optoisolators and into the ADC of the microcontroller. This will enable the unit to perform automatic 3D sweep searches for maximum or minimum with the option of logging the data back to a PC over a USB cable.

Basically the unit will be able to do lots of different jobs just by changing the software, a kind of swiss army knife for the lab, not bad for 50 euros worth of kit.

NOTE:
It's progressing at a slowish rate because I work in the day and spend time with family in the evening.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: innovation_station on October 09, 2008, 04:24:49 PM
wow!!  awsome job bro 8)

i would just love to get my hands on somthing like that....

might you be intrested in designing some pwm's  i would be intrested in re selling your kits..or compleated units my web page in in the works and can easly be expanded should you be intrested ...

agin great work!!

ist

i would really love a TUBE unit   ;) ;)
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on October 20, 2008, 05:48:10 PM
Hi ist,

For just PWM it would probably work out cheaper to use some dedicated chip for PWM generation. But if you want the screen for displaying freq and duty then a microcontroller like this can't be beaten.

If you get yourself an Arduino or Freeduino board from www.nuelectronics.com then I would be able to post you source code to generate PWM with it. Trouble is that nuelectronics are currently out of stock on the LCD modules, but they have just released a 4k colour 128x128 pixel screen addon for £20. The screen is a nokia unit and you could display realtime scope image of the generated PWM waves, it could be pretty cool!:

http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=1&products_id=10

nuelectronics are also really good, fast and cheap on international shipping, and they take paypal, I think they have great stuff at great prices!

Best, Yucca.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: z.monkey on October 20, 2008, 06:28:53 PM
Howdy Yucca,

So your Arduino/Freeduino boards are prototyping boards?  What kind of processor are you using?  The DS1085 chips are serially programmable and you have an SPI port going from the processor to each DS1085.  I love those tricky little Dallas Semiconductor parts.  I live close to their plant.  So then the signals from the DS1085 go out to some power amplifiers?  What are you using for a power supply, and power amplifiers?  I noticed that you are using C++, ever get into assembly language?

I have a number of products based on Microchip Microcontrollers.  Some of these products are USB slave devices, and when in high speed mode I can get 48 MHz processor clock speeds and 96 MHz USB clock speeds.  I frequently use Hitachi LCD display products when I need to have a visual display.  Mainly I only use text displays, for cost effectiveness.  However Microchip has some new microcontroller products that have enough computational horsepower to run a QVGA GUI.  So I have been thinking about making a new visual platform which is a touchscreen GUI which is microcontroller based.  My product sales haven't been very good this year for the microcontroller based products so any new project will probably be at the hobby level and not a production level device.  I program in assembly language and compiler BASIC.  My BASIC compiler is designed around Microchip's ampasm, so I can use assembly statements in line with BASIC statements, and also write my own macros.

Had you planned on making a system overview drawing?

If you are looking for LCD deals check this place out.  http://store.earthlcd.com/

OK, Mo Later...
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on October 20, 2008, 08:05:31 PM
Hi Z.Monkey,

Quote
So your Arduino/Freeduino boards are prototyping boards?  What kind of processor are you using? 
The boards come with 16MHz ATMEGA168 8 bit RISC 32K Mem.

Quote
The DS1085 chips are serially programmable and you have an SPI port going from the processor to each DS1085.  I love those tricky little Dallas Semiconductor parts.  I live close to their plant. 

Yes, I've still got to write the code to program them up. Great parts, only 8 pins but can do so much via the SPI.

Quote
So then the signals from the DS1085 go out to some power amplifiers?  What are you using for a power supply, and power amplifiers?

The unit has a small 5V supply for the MCU. I  will have my variable voltage and current benchtop supply go into the unit, this will then be chopped by the FETs in the unit. My FETs will limit my output freq. to ~25MHz but I might get faster ones in future.

Quote
I noticed that you are using C++, ever get into assembly language?

I've worked with assembly quite a bit, the good thing about C/C++ is that you can embed an assembly routine right into the code if you need fast bits just like what you're doing with ampasm. I used to work with 68000, 68HC11 and Z80 quite a bit and have done pure assembly on those, takes longer as you know but you can get nice optimised fast routines. I've noticed though that modern compilers tend to be alot cleverer with regard to optimising nowadays and I seldom need to use assembly but I still do now and then even when windows programming.

Quote
Had you planned on making a system overview drawing?

Yes, I should do that, when I've finished and settled on how I want it I will make a block diagram using a paint package.

Cheers for the link, some very fancy LCDs on that site :)

Best, Yucca.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on November 23, 2008, 02:42:46 AM
OK, finally got my Arduino to talk to the DS1085. That was the most difficult peripheral chip I´ve ever worked with! But it´s very sweet with less jitter than I expected, looks nice and stable on scope.

Have tested my FET drivers and they are  good for up to only 21MHz.

The unit will now only be 2 channel:
channel 1 for LF (DC ... 1MHz)
channel 2 for HF (8.2kHz...21MHz)

I´ve also put a thermometer device in that will enable the arduino to monitor the heatsink temperature and then disable output and sound a small audio alarm signal if the sink exceeds a set temp. It should help save FETs.

Now I just need to complete all the other hardware.  When finished I´ll take a few more photos of it.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: europeanhillbilly on December 10, 2008, 11:41:12 PM
Now that's cool!
I ordered an Arduino Duemilanove some days ago, today I got an email it got shipped. And just NOW I find this thread - I guess my weekend is planned now! :D
Great job Yucca, just what we all need!
When I get my Arduino board, I'll try my best to replicate your PWM circuit. Hope you don't mind a question now and then. :)

Talk to you soon :)
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on December 11, 2008, 03:17:12 AM
Thanks europeanhillbilly (Nice handle by the way!)

Fire away with any questions as and when you want.

If you want to just build the low freq version to get started then just buy yourself a LCD shield, quite cheap and fast ship to europe and its pin compatible with the Duemilanove:

http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=1&products_id=2

with just that and your arduino board you will get 5V 20mA PWM generator with adjustable freq and duty cycle by loading up the program listed on page one of this thread.

The only hardware work you will need to do is to clip or solder a single lead to one of the port pins and then use that output wire to drive FETs on breadboards etc.

Yucca.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: europeanhillbilly on December 11, 2008, 06:43:56 PM
Great, I'm about to order the LCD keypad shield and a ProtoShield Kit. Thanks!

One killer feature would be to have a shunt connected to the Arduino that measures the amp draw. The Arduino could then figure out the duty cycle to keep the load at that power level.
Any suggestions? :)

What you call LF (is 1Mhz really so low? ;) ) should be enough for the first tests. This may be a stupid question, but the arduino page says the hardware has multiple pins configurable as PWM output. I guess then those pins can only be driven by *one* frequency at a time, is that right?

I'm really looking forward to this, hope you don't mind me being a total newbie with microcontrollers. :/

Greets, ehb
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on December 12, 2008, 11:04:37 PM
Great, I'm about to order the LCD keypad shield and a ProtoShield Kit. Thanks!

One killer feature would be to have a shunt connected to the Arduino that measures the amp draw. The Arduino could then figure out the duty cycle to keep the load at that power level.
Any suggestions? :)

What you call LF (is 1Mhz really so low? ;) ) should be enough for the first tests. This may be a stupid question, but the arduino page says the hardware has multiple pins configurable as PWM output. I guess then those pins can only be driven by *one* frequency at a time, is that right?

I'm really looking forward to this, hope you don't mind me being a total newbie with microcontrollers. :/

Greets, ehb

Yes the arduino has a few PWM pins and you can generate I think 3 different freqs, I´m just using one PWM output. Unfortunately the LCD and jogwheel take up the others.

1MHz is fairly quick, but it´s LF. I want HIGHER! I would like to goto GHz in the end, but this I don´t know enough about when it comes to stable(ish) oscillators and amps,.

I will be adding a software gate function to the LF channel this will vork in the ELF to VLF band range. And then you will be able to generate Meyer like waveforms.

I am thinking about current sensing at the moment, a shunt would certainly be a good way of measuring RMS amps via one of the ADC pins. Will have to smooth output with a parallel RC circuit prrior to sampling because the sample rate is quite slow.

Microcontrollers are easy with the Arduino, Just need to know a little C or C++. The free dev environment is really simple to setup, just plug the board into USB and go!

What are you going to use it for first, HHO?

Yucca.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: europeanhillbilly on December 12, 2008, 11:22:14 PM
I was just re-reading your posts and the code here :)
HHO will most likely be my first use, yes.
Although I would also like to test PWM with a plasma electrolysis cell. Not sure what parts I'd need for switching 300VDC though.

I need to crawl before I walk, so my first use would be dimming an LED :D

I got the Duemilanove in my hands right now, sweet small piece of hardware. I haven't coded in C yet, only 'stupid people' stuff like ruby, php and some ecma script. Will need to wrap my head around it, but should be managable. Haven't done alot with electronics yet either, so yeah, I'm a bloody beginner.

I'd be really thankful if you'd manage to find a way for measuring the amps. Have you heard of the "HHO VMU"?
http://www.xo1ox.net/hho/shop/item.asp?itemid=33
Seems to be a good product, but open source is always a better way :) Reading up on some arduino libraries, OBD monitoring could well be on the feature wishlist for 2010 or so ;)

I haven't ordered an LCD shield yet, will do right now. Do arduinos tend to be easily breakable? Then I'd order a second one, just in case.. (now that I need to order in GB anyways)

Cheers and thanks for your efforts, ehb
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on December 12, 2008, 11:49:53 PM
Yes I´ve seen the VMU, it is indeed a sweet little unit.

I also have another project on my bench at the moment called HHOBox.

http://www.HHOBOX.com

It´s still in devmode but preliminary specs are:

DC...1MHz
PWM
Gating
1 channel RMS Amps
FET Heatsink Temp
CELL Temp
EFFIE up to four sensors
Audio alerts

Yucca.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on December 13, 2008, 12:01:12 AM
ehb,

IRF 730s go up to 400v, each FET can handle about 5amp, you can parallel them for more current.
http://www.datasheetcatalog.org/datasheet/fairchild/IRF730.pdf

Arduinos are as tuff as any PCB I think, but the stackable shields will fall apart if shaken too much, nothing a few rubber bands won´t stop though ;D

Yucca.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: europeanhillbilly on December 30, 2008, 09:01:47 PM
Hey Yucca and all others interested,

I received my LCD shield today, hooray! Looks cool, esp. for that price (man the british pound is down) :D
So now I wanted to go ahead and load up your source code, and realized you've taken it down. Humm :)
It would be nice if you could post the source code in .txt form here, or maybe use http://pastebin.com/
I'd be grateful, I'd love to break some fets soon :)

Greets, ehb
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on December 31, 2008, 01:18:58 AM
Hi EHB,

I've attached it to this post as a .txt file, just copy and paste into your Arduino.exe programmer/editor and compile.

You will have to add the LCD4Bit_mod library to the project.

I've just read that nuelectronics have changed the LCD board since I purchased mine and they use a pin that I have used for the piezo, so you may have to mod the pin assignment for the piezo in the code. It should work ok though as long as you have the modified library from nuelectronics.

Let me know how it goes. :)

Yucca.
Title: Re: Open Source 3 Channel Frequency Generator
Post by: europeanhillbilly on December 31, 2008, 02:17:15 AM
You're da man!  ;D
I'll try it asap, first sleep.

Thanks alot! :D
Title: Re: Open Source 3 Channel Frequency Generator
Post by: europeanhillbilly on December 31, 2008, 06:35:52 PM
It works like a charme, at least the LCD says so :)
Great work man.
Only problems I had were with the includes of io.h and interrupt.h. Arduino0012 software reports: "23: error: interrupt.h: No such file or directory".
Prefixing the filenames with avr/ fixed this problem though.

Now I've gotta figure out how to attach a jog wheel and lateron the mosfets.
I'll get an oscope tomorrow, so I can check the output frequencies.

Really cool stuff, now go out and celebrate new year :)
Title: Re: Open Source 3 Channel Frequency Generator
Post by: europeanhillbilly on January 01, 2009, 03:43:21 PM
Just measured the output of the Arduino PWM.
Frequency and duty cycle are dead on, measured with a Fluke 124 40Mhz oscope.
Great stuff :)

Now how would I attach a mosfet to switch 60V or more? Possibly with an optocoppler or something to keep the 60V from getting to the Arduino?

Thanks alot Yucca, great work
Title: Re: Open Source 3 Channel Frequency Generator
Post by: Yucca on January 04, 2009, 03:41:25 AM
Hi EHB,

Sorry for the delay in replying. Glad you got it going OK. yes freq and DTC are spot on thanks to using the hardware PWM circuit within the arduino chip. And because the arduino board uses a crystal clock it is almost jitter free and very temperature stable.

For switching at 1MHz use any old N channel FET like IRF730 which goes up to 400v. Use that to chop your neg line.

You could use an optocoupler to protect your MCU yes that´s a good idea. You could tie the FET gate to ground using a resistor and then wire the optocoupler output to the gate. Higher resistance value will give faster turn on and slower turn off and vice versa.

For the stuff I´m doing I like to have as fast rise and fall times as possible so I use a UCC27322 FET driver it also provides a level of protection for the MCU and has a built in charge pump so it even works fast off the MCU 5v supply. Some fast FET drivers need plus and minus 12v supply to achieve the fast switch.

Note, there are a couple of blind spots in the PWM output where certain frequency selections cause no output, this is a bug in the algorithm that sets up the hardware timers and I will try and remedy it soon.

Yucca.