USB HID chip (atmega32u4) cheaper, faster alternatives? - Page 1
Forum section: electronics / general

author: 3dgeo
author_rank: Frequent Contributor
timestamp: February 15, 2019, 12:38:08 am
content: Hello,I'm making USB keyboard, and was wondering is there a cheaper (under 3 USD) Atmega32u4 alternatives? Also would be nice to have more CPU power for LED animation calculations.Maybe cheap (if there are any cheap chips) I2C to USB HID chips and STM32 MCU? I'm not familiar with this scenario, so any suggestions are welcome.Thanks.EDIT:sorry, as usual I was dumb and didn't include all information that I should:What I need from MCU:USB support (HID keyboard)7 fast switching regular digital outputs (not PWM)5 regular digital inputs (optional - 5V tolerant)I2COptional - 9 to 18 capacitive touch input pinsOptional - SPI64k< program memory48MHz<~1K EEPROM (I noticed STM doesn't have EEPROM, so external IC for that is needed?)I prefer it to be Arduino compatible.

author: NorthGuy
author_rank: Super Contributor
timestamp: February 15, 2019, 12:47:02 am
content: PIC16F1454 is about $1. Probably too small, but certainly can do I2C.

author: ataradov
author_rank: Super Contributor
timestamp: February 15, 2019, 12:57:49 am
content: SAM D11. ~$1 and way more powerful.

author: bobaruni
author_rank: Regular Contributor
timestamp: February 15, 2019, 02:06:04 am
content: STM32F042 is around USD $2 or AUD $3.It has crystal-less USB, built in USB bootloader and no resistors or diodes are required for the USB interface but you will need a small 3.3v reg!

author: wraper
author_rank: Unknown
timestamp: February 15, 2019, 02:16:26 am
content: Silabs EFM8UB series, Starting from about $0.75 @ qty of 1, crystal-less and has built in 3.3V 100mA vreg.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: February 15, 2019, 02:24:50 am
content: Quote from: 3dgeo on February 15, 2019, 12:38:08 amThe SiLabs EFM8UB3 has 40k of Flash, and a 48MHz CPU speed.Lists ~ 93c/1kEFM8UB1 is even cheaper, but has less code space and it sounds like you may need more code space if you are 'adding features'

author: 3dgeo
author_rank: Frequent Contributor
timestamp: February 15, 2019, 01:24:37 pm
content: Thank You all for help,SorryI forget to mention – it should be Arduino compatible.

author: tsman
author_rank: Frequent Contributor
timestamp: February 15, 2019, 02:18:06 pm
content: Quote from: 3dgeo on February 15, 2019, 01:24:37 pmIf that is a requirement then a cheap "Bluepill" STM32F103 board and STM32duino.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: February 15, 2019, 02:59:50 pm
content: Quote from: tsman on February 15, 2019, 02:18:06 pmIt's not a requirement, but for now it's a bit too big of a jump to use other ecosystem, and I want to spin out 100-300 units of the 1st version and let users to reprogram it easily if they have need to do so. I guess it's not the end of the world to use Atmega32u4 for version 1.0, but I definitely will be using other controller on v2.0. It's a bit intimidating to start to work with other ecosystems, I don't know where to start.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: February 15, 2019, 09:51:28 pm
content: Quote from: 3dgeo on February 15, 2019, 12:38:08 amThere is SiLabs CP2112 = I2C to USB HID chip ?, or slightly more FT260 is faster i2c choices, and includes a HID UART channel too ?

author: Doctorandus_P
author_rank: Super Contributor
timestamp: February 20, 2019, 03:15:11 am
content: I'm with TSman.For "arduino" combatibility the cheap "Bluepill" STM32F103 boards seem a very good choice.You can start with breadboard compatible modules, and later move on to bare TQFP chips.The Price/performance ratio of this chip is exceptionally good and the STM32 chips are also used in a lot of the cheap products from Ebay / Ali / China.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: February 20, 2019, 11:06:31 am
content: Quote from: Doctorandus_P on February 20, 2019, 03:15:11 amIs it hard to make STM32 as a HID? Keyboard HID in particular?

author: exe
author_rank: Unknown
timestamp: February 20, 2019, 11:34:34 am
content: Quote from: 3dgeo on February 20, 2019, 11:06:31 amI did that, stm32f103 is natively supported by qmk (probably other stm32 chips too, if you have spare time to figure out how to do that). But it's not arduino. I dunno how many keyboards you want to make, but I suggest save your time and just buy part that will work for you. Otherwise you may spend weeks just to save $3.

author: magic
author_rank: Super Contributor
timestamp: February 20, 2019, 01:02:38 pm
content: If you need a cheaper and smaller atmega32u4, there is the at90usb162. It can work self-powered from USB using only a few passives and it will run all your software with minimal modification, subject to memory limits and at the same speed.

author: exe
author_rank: Unknown
timestamp: February 20, 2019, 01:04:53 pm
content: btw, they are cheaper on aliexpress. Obviously, quality cannot be guaranteed.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: February 20, 2019, 07:04:04 pm
content: I want to make at least 100 of them, I have few "blue pills" from ALI, they work just fine (didn't try USB compatibility), but for V1 ATmel32U4 will be enough, V2 definetly with STM32. Can You link tutorial how to set up STM32 USB HID?

author: martinayotte
author_rank: Regular Contributor
timestamp: February 20, 2019, 08:50:55 pm
content: Quote from: 3dgeo on February 20, 2019, 07:04:04 pmOn stm32duino.com forum, there was discussions/posts about HID Composite Library, the thread is 15 pages long ...http://stm32duino.com/viewtopic.php?f=13&t=2926&hilit=HID+KeyboardAnd this one as a followup, with thread of 3 pages :http://stm32duino.com/viewtopic.php?f=9&t=3994&p=48224&hilit=HID+Keyboard#p48224The code of the library is there :https://github.com/arpruss/USBComposite_stm32f1

author: technix
author_rank: Super Contributor
timestamp: February 27, 2019, 05:28:39 pm
content: I have some example code for using STM32F042 in USB HID mode.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: March 04, 2019, 01:01:58 am
content: Quote from: technix on February 27, 2019, 05:28:39 pmHey, would be awesome if you share it. I made a prototype with 32U4, but it's just too slow, I have to upgrade to STM32.What I need from MCU:USB support (HID keyboard)7 fast switching regular digital outputs (not PWM)5 regular digital inputs (optional - 5V tolerant)I2COptional - 9 to 18 capacitive touch input pinsOptional - SPI64k< program memory48MHz<~1K EEPROM (I noticed STM doesn't have EEPROM, so external IC for that is needed?)If I can eliminate capacitive touch IC and replace 32U4 with STM32F103C8T6 it would be perfect.BTW, to make STM32 "blue pill" as HID keyboard was waaaaaaay easier than I expected, it's as simple as burning a bootloader as described in a video below (burning bootloader is optional, I burn it cos I don't want to use FTDI) and usingUSB Composite library for STM32F1, I don't know why but I thought it will be way harder to migrate to STM32. I should went with STM32 from the start... You live you learnThe last thing I need to finalize functionality of my software is to add multimedia keys support, but as I understand it's not a same thing as HID keyboard.

author: Scrts
author_rank: Frequent Contributor
timestamp: March 04, 2019, 02:29:23 pm
content: Quote from: 3dgeo on March 04, 2019, 01:01:58 amI'm just curious: what GUI interface and libraries do you use on host side? I'd guess its Windows. Did you develop app for that as well?

author: 3dgeo
author_rank: Frequent Contributor
timestamp: March 04, 2019, 03:15:21 pm
content: Quote from: Scrts on March 04, 2019, 02:29:23 pmAdditional libraries (GUI) are not required if the MCU (in this case 32U4 or STM32F103) supports HID, OS automatically recognizes it as a Keyboard or other HID device that you specify when coding. But I plan to create a special OS gadget with Visual Studio.Beja, sveikas.

author: plogue
author_rank: Newbie
timestamp: March 05, 2019, 07:42:50 am
content: STM32F103 could be a nice option as it has plenty of I/Os, flash & RAM. You might even get the cheaper clones (I haven't tried them yet) like the GD32F103 or the CS32F103.

author: ebclr
author_rank: Super Contributor
timestamp: September 28, 2019, 04:22:07 am
content: WCH554https://github.com/Blinkinlabs/ch554_sdcchttps://www.electrodragon.com/product/ch552-ch554-mini-dev-board-ch55x-series/https://item.taobao.com/item.htm?spm=a230r.1.14.22.283437f0jYYmR5&id=566925525140&ns=1&abbucket=1#detail