• Low end MCU Selection

    2 days ago 0 comments

    Requirement

    • low power : 3V3 or lower, not 5V powered
    • at least 7 GPIOs, 9 preferred.  We don't want to read the status of the switches with an ADC.
    • as small as possible
    • cheap
    • easy to solder
    • Availability : 2nd sourced
    • PlatformIO / Arduino support

    The Arduino support seriously limits the choices.  8MHz on a 1V8 AVR-architecture is out of spec.  Higher supply voltages are needed, which imply the addition of a boost converter when powering with two AA-batteries.

    Choices

    Arduino Pro Mini 328 - 3.3V/8MHz

    • Newer versions have four extra GPIOs : pin A4, A5, A6 & A7.  These are located two by two on the right hand side of the MCU.  Older versions have only two extra GPIOs.
    • Requires an FTDI serial USB converter for programming.
      • Warning! : When using a TTL-3V3-WE cable, the signal levels are 3V3, but the VCC level is 5V! The problem is that this FTDI VCC pin is directly connected to the 3V3 VCC pin on the Arduino.
      • Either disconnect FTDI VCC or connect it to the RAW pin of the Arduino Pro Mini.
      • 5V on VCC is no problem for the Arduino Pro Mini, but it might be disastrous to your connected 3V3 peripherals.
    • 33 x 18mm
    • fits in a DIP (2x12 pins, 0.6" row spacing) socket.  Height can be reduced by inserting the headers from top side and solder them from bottom side.
    • Sources for DIP socket :
    • Where to buy : AliExpress 32341782884
    • Getting started : Sparkfun : Using the Arduino Pro Mini 3.3V

    Adafruit Pro Trinket - 3V 12MHz

    ProTrinket 3V has same pinout as 5V version
    • Adafruit
    • 38x18mm
    • 20 GPIOs
    • Mouser 485-2010: €8.69
    • faster than ItsyBitsy 32u4, but less IO and limited USB support (no CDC)
    • with the FTDI header, there's no need to push the reset button every time you want to upload code.
    • 12MHz is an uncommon frequency.  Some libraries won't work out of the box.
    • D7/AIN1 is used for USB, so the analog comparator functionality is crippled.

    Adafruit ItsyBitsy 32u4 - 3V 8MHz

    • 36x18mm
    • 23 GPIOs
    • native USB (HID, CDC)
    • PlatformIO support
    • ItsyBitsy M0 Express is a performance upgrade for this board.
    • Mouser 485-3675: €8.69
    • Only to be used when you want decent USB support and an AVR-architecture.  If AVR is not strictly needed, you'd better go for the ItsyBitsy M0 Express

    TinyDuino Processor Board

    • 20x20mm : tiny, but widest board
    • connection through fine pitch board to board connector
    • 20 GPIOs
    • Mouser ASM2001-R-B: €10.87
    • Requires stack-on PCB to make the GPIOs available and for programming.
    • This board also has an SAMD21 upgraded version.

  • Audio module

    6 days ago 0 comments

    Most clocks use sound to wake you up.  This clock is no exception.

    A little "DFPlayer Mini" module does all of that, also MP3 decoding.  It even includes a speaker driver.

    Yuexin YX5200-24SS module

    Works like a breeze with the platformio.  Be careful to connect your module correctly.  I've already destroyed one by wrongly connecting it and nearly killed a second one.  Strange...the polarity is clearly marked on the module.

    • User experience from Markus Wobisch
    • Library:
      • The official library from DFRobot locks up when making too many calls to it.
      • DFPlayer Mini Mp3 by Makuna is a better alternative
    • Before copying music files, normalize their volumes.
      • sudo apt install python-rgain
        replaygain --force *.mp3 
        

        I have the impression that it works well on a PC, but that the DFPlayer ignores the normalization.  I have also tried to use Audacity using the procedure described here, but also with disappointing results.

      • sudo apt install ffmpeg
        ffmpeg -t 430 -i 2.mp3 2b.mp3

        One song ended in a 1min20s silence.  The ffmpeg command allowed me to strip that pause off.

    • There are two options for audio output: headphones (stereo) and speaker (mono). 
    • Speaker output is generated by the on-board amplifier.  According to the VCC, GND and speaker connections, the amplifier is a PAM8302A (or LM4871, or XPT4871, or YX8002-8S).  This one can send 2.5W into a 4ohm speaker.  That's certainly loud enough.
    • The speaker output of the module certainly needs filtering to reduce EMI.
    • The speaker sound lacks low frequency content.  The input coupling of the PAM8302A might have a too high corner frequency.  Let's see what other designs are using:
      • Elektor "PAM8302A Audio Amplifier" (issue June 2018) : 180ohm in series with 220nF
      • Adafruit 2130 : 100ohm in series with 1uF
      • DFRobot advises to add a 1K resistor in series with the RX-line (pin 2) to reduce noise.
      • See also Markus Wobisch schematic to reduce noise.
    • EMI precautions : see Elektor "PAM8302A Audio Amplifier" (issue June 2018)

    WTV020 module

    GeneralPlus GPD2846A module

    This module doesn't seem to allow control by a MCU, except through USB.

    GeneralPlus GPD2856A module

    This module doesn't seem to allow control by a MCU, except through USB.

    PWM output

    It doesn't look like there's already an established solution for the STM32 platform.  This will require lots of work.

    The cheapest option would be to generate sound using PWM, but it requires some work.  The sound files also need special conversion before storing them to flash.  An output amplifier is needed for connection to a speaker.

    Arduino Wave shield

    It uses a MCP4921 DAC and an SD-card.  Both are SPI devices, but they're connected to a different bus.

  • DCF77 decoder

    6 days ago 0 comments

    Assembled unit (lid removed to show internal construction)

    Design

    Schematic design and PCB layout can be found on EasyEDA.

    Housing

    The DCF antenna doesn't work well when it's in proximity to EM-noise sources.  Possible noise source are the rest of the electronics of the clock or a laptop.  The solution is to put the DCF-antenna and the decoder in a separate housing.  It might not be necessary to use the separate housing once the clock is properly designed instead of using the breadboard and flying wires.

    Steps to follow:

    Main components

    Connector

    It should be easy for the customer to find a suitable cable assembly to connect the box.  The connector should also be small and low profile.

    • Stereo audio jack cable :
      • flexible, cheap, readily available
      • user might be tempted to connect headphones.  This must be avoided.  At the least, the headphones shouldn't be damaged.
    • Modular jack cables :
      • 4pins, 6pins, 8pins, common use in POTS telephony and ethernet. 
      • Ethernet cables are not that flexible.
      • Big connector.  Might not fit inside the housing

    The initial idea was to mount a TRRS audio headset socket directly on the PCB,  Doing this would make it hard to correctly drill the needed hole in the front panel.  Moreover, such a connector, which needs to be placed against the wall of the housing would require a longer PCB than stated in the datasheet of the box.

    Two JST XH connectors will be used instead.  One connects to a panel mount TRRS audio headset socket.  The other connects to a panel mount LED.

    Cable assembly

    Many audio cables are constructed as two pairs of two wires.  So the left and right channel each have their ground wire in close proximity.  The ground wire is connected to the sleeve.  To take advantage of that cable configuration, the GND signal is here also connected to the sleeve.

    JST XH
    SignalAudio jack
    23V3Tip
    1OUTRing
    3GNDSleeve