Close
0%
0%

DaFunc

Simple pocket sized function generator

Similar projects worth following
This pocket function generator will allow for simple waveforms to be created. The interface is yet to be decided, but the goal of the project is to be simple yet functional.
The device will be battery powered, battery type to be determined.

View all 12 components

  • That's all folks!

    gannon01/03/2015 at 05:15 0 comments

    Well, for the contest that is.

    There's many things left on the TODO list for features that are still partially implemented. Not necessarily in the following order:

    1. Create a better case design
    2. Fix minor issues in board design
    3. Finish menu system for configuring the device
    4. More thorough testing (once I have the tools I would need to test it!)

    It's been a fun month working on this on and off. It's been my first electronics project from the ground up for a long time.

  • I SPY

    gannon12/30/2014 at 14:30 0 comments

    With my little eye, an unrouted wire!

    At the same time, only ONE unrouted wire. And it's even in a convenient location as I can just use a solder blob to fix it.

    But of course that isn't the only issue. The 4 pin connector for the display was rotated 180 degrees and I didn't notice in time... Quick fix of course was to wire it up rather than using a pin header. I just hope none of the wires break off.

    I assembled the PCB and attached everything to it last night. I even documented the process a bit with some pictures and video! Well, until my camera battery cut out around half way through the hard part. I'll work on editing those together later.

    I tried to get the Trinket Pro working on my computer last night without any luck. It might be the USB cables, or just the computer. I will try with a different computer, but if that fails I'll be slapping my FTDI friend on the Trinket for now.

  • 17 day turnaround

    gannon12/29/2014 at 17:25 0 comments

    Pleasantly surprised with my first run through OSH park. I payed less than $13 for these boards, and a lot of that was shipping to get them here even one day sooner. I should have finalized the PCB design earlier, now I only have a few days left to assemble the prototype and get the firmware working! If there's an error in the PCB design things are going to get a bit interesting...

    I should have cleaned up the schematic and released it over the holidays. Now even more things to do.

  • A typical Case

    gannon12/22/2014 at 16:30 0 comments

    Every project needs a case! Currently I have a rectangular case designed around the parts using OpenSCAD. The top and bottom are open to allow fitting parts in for testing.

    A few revisions later and I have something that is the correct size for everything. I'll try to finalize the design soon to be a 3 part case. Top shell, bottom shell, and battery door.

    I haven't done much on the firmware side while I have been waiting for the PCB to come in, but I should replicate the PCB on a bread board and test everything out. Need to hunt down friends with an oscilloscope to look at the output at all though... Well, the output frequency should be low enough that I should be able to use a sound card and a computer to look at the signal. We'll see.

    In the event that the PCB doesn't arrive in time I'll have to wire everything up on some perfboard. I hope the PCB arrives with some time to spare!

  • PCBs ahoy!

    gannon12/12/2014 at 22:32 0 comments

    After finally settling on what the system needs I put together a quick schematic and board in Eagle. This is far from my best work, but I was in a hurry to get it out to OSHPark because of the turn around time. In the event that the PCB doesn't come in with enough time to spare I suppose I'll just have to deadbug everything! ;)

    This PCB should allow me to fit everything into a case that is 30mm wide, 100mm tall, and 20mm thick.

    Without further ado, here's a bit of an overview of the PCB.

    On the top I will be mounting the output port, the I2C OLED screen, 2 pullup resistors, and rotary encoder. I chose the 2x5 IDC connector for the output port because I just happened to buy a bus pirate and can reuse the clip leads that I bought with it. The outputs are as follows.

    • 2 analog buffered outputs
    • 2 digital buffered outputs
    • 2 digital unbuffered outputs
    • RX
    • TX
    • 5V
    • Ground

    On the bottom I have 2 low pass filters and a quad op amp. The Trinket Pro will also be on this side. I designed the filters using a Sallen Key filter design tool that my friend made. He will eventually make this public once he cleans it up, but it is pretty easy to use as long as you know a bit of python currently.

  • Trinket Pro Interrupts

    gannon12/09/2014 at 18:02 2 comments

    As you may have noticed I have been prototyping my system on an Arduino Pro Mini rather than a Trinket Pro so far.

    Although the system is the same on many levels there are a few distinct differences that need to be accounted for.

    1. The Trinket Pro has a USB bootloader in the firmware that reduces the usable code size by ~3kB
    2. The Trinket Pro uses 1 of the 2 external interrupts for USB
    3. Not all pins are avaiable on the Trinket Pro

    Number 2 is the big one I didn't take into account so far in my code. I use an interrupt for reading the rotary encoder and another for reading a button press. After I realized this I was worried that I would need to start continually polling the inputs in a loop rather than using the external interrupts, but I have been saved!

    It ends up you can set up an interrupt on any of the IO ports of the microcontroller. This means I can hook up all my inputs to a single port, interrupt on any change to that port, and then actually read each of the inputs to see what happened. More information on how to set up this type of interrupt is available at http://www.geertlangereis.nl/Electronics/Pin_Change_Interrupts/PinChange_en.html

  • UI first steps

    gannon12/08/2014 at 23:20 0 comments

    I got my 0.96" OLED display in today to play with after work. After wiring it up into my test setup I attempted to draw an image of a sine wave only to find some odd results...

    Easily enough fixed though after realizing I had packed the bytes incorrectly. Now to see if I can fit the OLED code along with the waveform code into the Trinket Pro...

    I'm hoping that I can. If so I will use the OLED screen and a single rotary encoder / push button combo unit as the input to the device. Unfortunately none of the ports on the Trinket pro are fully available, so if I want to use an r2r2 dac I would need to write my bytes to multiple ports...

  • Methods for creating analog waveforms

    gannon12/05/2014 at 03:13 0 comments

    There are two main methods of creating an analog waveform using a digital one. Due to various limitations of the Trinket Pro hardware the pros/cons are listed below.

    1. PWM driven Low Pass Filter
      1. Maximum analog waveform frequency between 3-6khz
      2. Only uses a single pin (with good fidelity with proper filter design)
    2. R2R DAC
      1. Maximum theoretical analog waveform frequency of ~2Mhz
      2. Uses mutliple pins (more for better fidelity)
    Due to the fact that method 1 uses only a single pin the function generator could theoretically contain 8 analog channels whereas you would be lucky to be able to get 2 channels from method 2.

    Given enough time I plan on using a mix of both methods 1 and 2, where I have a single high speed output line and multiple low speed outputs.

  • Simulations are fun!

    gannon12/02/2014 at 21:52 0 comments

    While waiting for parts to arrive I've decided to work a bit on the software side of things.

    Well, not actually the software that will run on the Trinket Pro, but some software to help predict what kind of results I can expect from the actual hardware once I get it all set up.

    The software currently generates a sine wave target, creates the PWM signal that will feed into the low pass filter, and displays everything in a neat little window. The "Scale" bar actually adjusts the PWM frequency. Not surprising, but this frequency can't be too close to your sine wave frequency or you won't get good results.

    To get good results it seems your PWM frequency should be about 10 times the frequency of the highest frequency sine wave you want to generate.

    Other wave forms should be simpler to create, especially digital ones.

  • The first steps

    gannon11/26/2014 at 18:37 0 comments

    So far I've been looking at various things. I've started with the following 3 steps/questions.

    1) What do I actually want the device to do?

    2) How should the user interface be set up?

    3) Spec parts

    As usual, answers to these questions just brings more questions.

    1) Should the device generate a single waveform, or multiple waveforms? This changes the type of DAC that I will need to create.

    2) There's only 28kB of space on the trinket. A complex UI using something like an OLED screen will most likely not fit on top of the waveform code. Let's go with buttons, people like lots of buttons, right?? Especially with no visual feedback...

    3) It ends up that in all actuality I found myself trying to spec the parts to fit my interface most of all. That's when I realized things might not be as easy as I hoped as one crucial part eludes me.

    In the mean time I have parts on order for fleshing out a prototype. Once I have a reasonable prototype worked out I can get back to worrying about the end product. Current system model is as follows, nothing too complex.

View all 10 project logs

  • 1
    Step 1

    The system should be pretty easy to set up with alternative components on a protoboard in the event that you don't want to make a PCB.

    For information on the initial software setup for flashing the Trinket Pro refer to the Adafruit guide at https://learn.adafruit.com/introducing-pro-trinket/overview

    The schematic is not the cleanest I've made, but I was in a hurry to get the board files out the door to get everything ready on time.


  • 2
    Step 2

    The low pass filters are set up in a Sallen-Key topology with the following components:

    • R1 = R2 = 820 Ohm
    • C1 = 0.068 uF
    • C2 = 0.033 uF

    The OLED data lines use 4k7 Ohm pullup resistors that are installed at R6 and R7 on the PCB. The OLED screen connector is rotated 180 degrees in the first PCB design file. This needs to be fixed in the future, but for now it is easy to fix in wiring.

  • 3
    Step 3

    The video doesn't have audio, but there are subtitles. Didn't have time to make a decent recording of the audio dub :/

View all 4 instructions

Enjoy this project?

Share

Discussions

rjtescher wrote 12/09/2014 at 20:09 point
Just a wild suggestion.
Add in a pattern generator for a video monitor. e.g. cross-hatch pattern for VGA,
I'm not sure if it is do-able.

  Are you sure? yes | no

Adam Gulyas wrote 12/04/2014 at 11:03 point
What about the purity of analogue? :P

  Are you sure? yes | no

Mike Szczys wrote 11/25/2014 at 19:34 point
Oooh, can't wait to see this one. I just got an oscilloscope but I don't have a proper signal generator yet. If you get code posted I'll surely test it out!

  Are you sure? yes | no

DainBramage wrote 12/03/2014 at 01:20 point
Same here. An Arduino function generator has been on my "to do" list for a while now. I look forward to seeing this.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates