I made a 10¢ MCU Talk

(atomic14.com)

102 points | by iamflimflam1 3 hours ago ago

33 comments

  • NoiseBert69 2 hours ago

    These CH32 mikrocontrollers are great and dirt cheap. I've build a small DC motor controller with them to control a toy robot: https://github.com/h0lad/MiniSpeedController

    The bigger ones have PHYs for USB HS, USB-C (5Gbps) and 10/100M Ethernet integrated (!). And their development environment (Mounriver Studio) isn't too bad - I didn't had the immediate urge to port everything to CMake/VSCode.

    But they need some kind of pin planning tool. It's awful to use the datasheet and find the correct pin functionalities and their mutual exclusions... STM32 mastered this with their STM32CubeIDE tool: select a feature (like USART1) and the right pins light up - alternate pins are easy to locate.

    They also should clean up their license mess on OpenWCH (their GitHub page). Lots (all?) of their HALs are Opensource - but the right version with right SPDX tags are often a bit hidden.

    • MisterTea an hour ago

      Nothing irks me more than "check out my neat-o PCB design" and there's no schematic.

      • amoose136 an hour ago

        It's kicad which means you can use kicanvas to view it. For example: https://kicanvas.org/?github=https%3A%2F%2Fgithub.com%2Fh0la...

        • jimmyswimmy 43 minutes ago

          What an amazing tool: it loads and displays the kicad native files in a simple web browser, but moreover - you don't have to be the intermediary, cloning some repo and then uploading the individual files to a website.

          I wish that existed for more weird binary formats. Altium have 365 but you have to have signins to use it, and they cost named-user seats.

        • MisterTea 42 minutes ago

          I use KiCAD so I know it well. Unfortunately that site is in alpha and I am unable to zoom in to see the schematic clearly.

          • inanutshellus 16 minutes ago

            FWIW - On my laptop (track pad), I expected to click-drag or ctrl-drag to move it, but on a track pad it's two-finger swipe to move it left/right. then pinch zoom.

          • amelius 36 minutes ago

            Use Ctrl+mousewheel to zoom.

            (Unfortunately, it does not zoom on the cursor but on the center of the screen).

          • kragen 37 minutes ago

            For me control-mousewheel zooms and shift-mousewheel pans horizontally.

          • stronglikedan 6 minutes ago

            pebkac error

        • NoiseBert69 43 minutes ago

          Oh.. I love this web tool. Thanks for showing!

      • NoiseBert69 an hour ago

        Feel free to have a look at the "pcb" folder.

        • MisterTea an hour ago

          Sorry, but I am not installing KiCAD or cloning a repo just to look at a schematic. Since the beginning of time electronics hobbyists have been posting schematics in bitmap or pdf format. It should be in the readme.

          • sampullman 9 minutes ago

            I'd agree with you in the past, when KiCAD didn't work as nicely with git. And for a professional project, I'd still at least keep snapshots of every milestone with "compiled" output.

            But for a hobby project I really don't see the need. It takes a few extra minutes to install KiCAD, clone the repo, and view the schematic at any point in time.

          • NoiseBert69 44 minutes ago

            Sorry my friend - but embedding static PDFs in Git is my opinion an anti-pattern. The KiCad (or EDA) sources should be the single source of truth, with visuals generated/exported locally when needed.

            If you don't like it.. well it's a free world and every engineer has it own preferences :-)

            • MisterTea 39 minutes ago

              Neglecting a schematic is an anti-pattern. And I never said it had to be PDF. Besides, of all the crap people shove in Git repos, a simple bitmap that compresses well and conveys extremely useful information has to be the least offensive.

              • NoiseBert69 30 minutes ago

                Maybe an idea for the next project: setting up a CICD chain which auto-generates them for releases. Will take a piece of your critics with me.

    • amelius an hour ago

      Can you change the polarity (direction) of the DC motors with this board?

      • NoiseBert69 an hour ago

        Yes. The DRV8837 has a pin for the direction. It's a H-Bridge.

  • thrtythreeforty 3 hours ago

    This is great. Missed opportunity for a low-pass RC filter on the speaker circuit - if you know you're driving an 8kHz sample rate, you can design your filter with that cutoff, and it'll sound way better (it'll get rid of the buzzy quality).

    • kragen 40 minutes ago

      This may be essential if you're connecting it to an audio amplifier. I learned this the hard way by burning out someone else's very expensive tweeters with 31.25kHz PWM.

  • kragen 41 minutes ago

    It's probably worth mentioning the 2400bps (300 bytes per second) LPC10 codec built into SoX. If you have SoX installed, try

        rec -t lpc10 speech.lpc
    
    and then speaking into your microphone for ten or fifteen seconds before you ^C it. Then play it back with

        play speech.lpc
    
    It will sound very robotic but pretty comprehensible, at least with an adult male voice in English, and it preserves a lot of the prosody and enunciation that is so hard to get out of speech-synthesis packages.

    12KiB of data at 300 bytes per second would be 41 seconds of recorded speech.

    Decoding the LPC10 data on the CH32V003 might be tricky. On amd64, running `make CFLAGS=-Os` followed by `ld -r -o tmp.o *.o` inside sox-14.4.2+git20190427/lpc10 yields a tmp.o with 25243 bytes of text (including .rodata, etc.) and 356 bytes of data. I'm not optimistic that RISC-V would compress that to fit inside the CH32's flash. And I find the code in that directory inscrutable; it's Fortran that's been compiled to C.

    Still, it seems plausible that you could massage the LPC10 data into a format that something like Talkie would understand.

  • pjc50 3 hours ago

    Nice work. Especially referencing the TI prior art of the Speak and Spell. This kind of synthesis was quite prevalent in the early 80s - school BBC Micros had a ROM which let you "*SAY" a phrase. Classic Macs had MacinTalk.

    Another codec which might be interesting to try but is considerably more complicated is AMR, from GSM: https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_code...

  • ctoth 2 hours ago

    You should be able to do it all on-device, check out SAM, the Software Automatic Mouth. The actual data in the *_tabs files:

    https://github.com/ctoth/SAM/tree/master/src

    • thomassmith65 an hour ago

      The sound in the video seems more sophisticated than TTS. It seems more like the result of analyzing a clip of digital audio, and turning it into a series of TTS phonemes.

      Assuming SAM is a faithful port of the original, it converts text into phonemes according to a bunch of pronunciation rules.

  • docdeek 3 hours ago

    Interesting, though before clicking I thought the headline might be referring to a very poorly paid presentation about Marvel movies.

    • pdntspa an hour ago

      Ha, seconded. I hate how acronyms get repeated between domains. Makes for very confusing reading if you're not part of the in-group.

  • dlcarrier an hour ago

    Can you export the schematic and Gerber files to a PDF file? A lot of open source projects do this, and it makes it much easier to tell what's going on, with software pretty much everyone already has on their computer.

  • MisterTea 3 hours ago

    Could hang an i2c flash chip off that thing for more storage and still have enough IO pins for serial coms and a spare IO pin.

  • zahlman 2 hours ago

    > I considered a few encoding options for compressing the audio.

    The presentation of this part seems extremely padded out to me, ironically enough.

  • Findecanor 2 hours ago

    I saw another audio project on the same microcontroller (family) posted a few days ago: ModPlayRISCV It plays a tracker MOD. using PWM with a low-pass filter. It resamples/scales all samples at varying rate/volume into a ring buffer which gets fed to the PWM comparator by DMA.

    https://github.com/cpldcpu/ModPlayRISCV

  • colechristensen 2 hours ago

    First I thought you made a lecture on MCUs which was available for viewing in exchange for $0.10

    Then I thought you made a lecture on MCUs where the device was available for purchase generally for $0.10.

    Then I thought with an MCU valued at $0.10 you generated speech

    English... sigh

    • SJC_Hacker an hour ago

      This is why I prefer μC

      Although I guess that can also be confused with micro Couloumbs

    • SideburnsOfDoom 2 hours ago

      It has worse misreadings, it could be a cheap lecture on the "Marvel Cinematic Universe". (It's about cheap MicroController Units.)