Skip to the content
2 layers97.7 × 58 mmBluepill function generator, the printed circuit board in 3D

Bluepill function generator

BojanSof/BluePillWaveGen35

DDS function generator build around STM32 BluePill board

Size
97.7 × 58 mm
Copper layers
2
Thickness
1.6 mm
Parts
41
Nets
60
Pads
145
Tracks, vias
138, 0
Pours
2
Routed
Yes
KiCad
KiCad 6 (file 20211014)
Created
24 Feb 2022
Updated
24 Feb 2022

Overview

Bluepill function generator is an open-source printed circuit board by BojanSof, from the BojanSof/BluePillWaveGen repository on GitHub. It is a 2-layer board of 97.7 × 58 mm with 41 parts on 60 nets, routed with 138 tracks and 0 vias.

It is built around the ICL7660N and TL084. Its parts include 27 resistors, 8 capacitors, 3 ICs, 1 connector and 1 switch. It belongs with the STM32 boards of this library.

Main components

2

README

README.md

STM32 BluePill DDS WaveGen

DDS function generator implemented with STM32 BluePill board, based on STM32F103C8T6 microcontroller, 8-bit R-2R ladder DAC and additional circuitry for removing the DC offset.

The user interface is realized with OLED display based on SSD1306 controller and incremental rotary encoder.

Kicad PCB 3D view

Specs

Goal specs:

  • Waveforms: sine, square, triangle, sawtooth (arbitrary waveforms can easily be added)
  • Frequency: 0 - 35 kHz, frequncy resolution is variable
  • Amplitude: 500 - 3000 mV (software control)

Additional tests and modifications should be done to reach the specs.

Working Principle

WaveGen circuit

The MCU generates the data for the 8-bit R-2R ladder D/A converter.

Two of the op amps inside TL084 are used as voltage buffers, one for the output of the DAC and the second one for the variable voltage generated by filtering PWM signal outputed by the MCU. This variable voltage is used to remove the DC offset of the generated waveform. Removing the DC offset is realised with the third op amp, which subtracts the output of the DAC and the variable voltage and multiplies this difference by 1.82 so the output signal has maximum amplitude of 3 V.

DAC data generation

To generate the data for the DAC, each waveform has lookup table stored in the Flash memory of the MCU, with 256 elements with size 1 byte. The values stored in the table are actually the data that need to be fed into the DAC. During runtime, whole or part of the table is copied into SRAM of the MCU, based on the frequency of the waveform. By changing the LUT, arbitrary periodic waveforms can be generated.

Timer 2 of the MCU is configured to generate DMA request. It has base clock of 14.4 MHz and the value stored in the Auto-Reload Register (ARR) depends on the frequency of the waveform. The value for ARR is calculated using the following formula:

ARR=TIM2\_BaseClock/(L\*f) - 1

where L is the size of the LUT stored in SRAM and f is the frequency of the waveform.

The DMA unit transfers data from the LUT in SRAM to the GPIOA output data register. The pins PA0-PA7 are used to output the data to the DAC. Because the output data register of GPIOA is used, the pins PA8-PA15 can not be used as general purpose outputs, but can be used in the other modes. This problem can be resolved by writing to the bit set reset register instead of the output data register.

Software

The software was written in C, using STM32 HAL library, in STM32CubeIDE.

I have also written SSD1306 driver which can be further developed to include more functionalities.

The code also includes isntantenous rotational speed measurement for the rotary encoder with goal to change the values for frequency and amplitude based on the rotational speed, i.e. faster turning of the encoder results in greater change of the value. This part of the code should also be improved, for better user experience.

Experimental results

Protoboard version

The following waveforms are measured with DSO150 oscilloscope.

Sine 60 Hz 3000 mV Sine 60 Hz 2500 mV Sine 500 Hz 2100 mV Sine 2000 Hz 2000 mV Sine 5000 Hz 3000 mV
Sine 10000 Hz 2500 mv Sine 20000 Hz 3000 mv Sine 25000 Hz 1500 mv Sine 30000 Hz 1500 mv Sine 35000 Hz 1500 mv
Square 5000 Hz 3000 mv Triangle 5000 Hz 2500 mv Triangle 9000 Hz 2500 mv Sawtooth 15000 Hz 3000 mv Triangle 35000 Hz 2000 mv

Further improvements

  • Additional tests and calibration to conclude the frequency and amplitude resolution
  • USB virtual serial port to transfer LUT data for arbitrary waveform
  • Low-pass filter after DAC output

Parts

41
QtyValueFootprintReferences
1610kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR2, R3, R4, R5, R6, R8, R10, R12, R14, R16, R17, R18, R19, R20, R23, R26
920kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR1, R7, R9, R11, R13, R15, R21, R25, R27
6100nCapacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mmC3, C4, C5, C6, C7, C8
210uCapacitor_THT:CP_Radial_D5.0mm_P2.50mmC1, C2
218k2Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR22, R24
1Conn_01x02_MaleConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ1
1ICL7660Package_DIP:DIP-8_W7.62mmU1
1OLED_SSD1306_128x64oled-displays:OLED-SSD1306-128x64DIS1
1RotaryEncoder_SwitchRotary_Encoder:RotaryEncoder_Alps_EC11E-Switch_Vertical_H20mmSW1
1STM32-BluePillbluepill-fgen:STM32-BluePillU2
1TL084Package_DIP:DIP-14_W7.62mmU3

Similar boards

  • 4 layers100 × 50 mmOpenHand v2, the printed circuit board in 3D

    OpenHand v2

    AleksaHeler/OpenHand

    Our attempt at a prosthetic hand using STM32 microcontroller with custom PCB and mechanics

    172 parts13MIT
  • 2 layers48 × 36.5 mmOsillyscope etchable, the printed circuit board in 3D

    Osillyscope etchable

    tvlad1234/osillyscope

    Low cost, low part count CH32V003-based oscilloscope

    31 parts30MIT
  • 2 layers138.8 × 55 mmMuxPi, the printed circuit board in 3D

    MuxPi

    SamsungSLAV/muxpi

    MuxPi is an open hardware and open software board which was designed to aid in automating tasks on physical devices.

    354 parts22Apache-2.0
  • 2 layers99.9 × 72.8 mmGR MT8816 Breakout, the printed circuit board in 3D

    GR MT8816 Breakout

    GadgetReboot/16x16_Analog_Switch

    MT8816 based 16x16 Analog Switch Matrix

    48 parts17
  • 2 layers125 × 125 mmJbc station, the printed circuit board in 3D

    Jbc station

    hrandib/jbc_station

    3 channel universal soldering station for T12, T115, T210, T245, T470 handles

    290 parts17GPL-3.0
  • 2 layers49.5 × 50.3 mmSharp dsi, the printed circuit board in 3D

    Sharp dsi

    jlywxy/project-display

    Mobile Display Test & Debug

    52 parts16GPL-2.0
  • 2 layers100 × 100 mmI8080-sbc, the printed circuit board in 3D

    I8080-sbc

    quasiengineer/i8080-sbc

    FPGA-based single board computer to run Intel 8080 CPU (up to 3.125Mhz)

    116 parts13

Questions

How big is the Bluepill function generator PCB?

It measures 97.7 × 58 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Bluepill function generator use?

41 parts, built around the ICL7660N and TL084. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Bluepill function generator KiCad files?

From the BojanSof/BluePillWaveGen repository on GitHub, at the commit this page was made from: the board is kicad/bluepill-function-generator/bluepill-function-generator.kicad_pcb and its schematic kicad/bluepill-function-generator/bluepill-function-generator.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Bluepill function generator design in my own project?

Its repository states no licence, so its author keeps all rights: ask BojanSof before reusing the design.