In addition to the main work, I do a lot of pet projects, but I never wrote about them. Now I decided to rectify the situation and write about the project that I just completed. This work by George Hilliard inspired me to create it .
Objective of the project
Make the cheapest USB Flash business card version, which would contain my resume, source code and a few more files. In doing so, use the available accessories that can be ordered on the LCSC and JLCPCB.
What did I need to do for this?
Pick up cheap, but not consumer goods, components, lay out a printed circuit board for them, solder them and write the firmware.
What does my business card end up doing?
As you might guess, my business card simulates a small USB Flash drive, which contains a bilingual summary, source code, firmware, gerber files, circuitry and circuit board, as well as my photo.
Main project nodes
Microcontroller STM32F070F6 - this was the cheapest version of the controller with a USB device on board that I found;
Winbond W25Q32 - 4 MB serial flash memory;
LEDs 0805 - white and blue colors, for beauty;
LP3992 - 3.3V step-down voltage converter, microcircuit power;
USBLC6-2 - static protection of the USB "connector".
My approach to developing pet projects
There is a certain way that I follow when programming microcontrollers:
- Do not use SPL, HAL and other libraries for programming peripherals. I adhere to this rule in my main job;
- Do not use OS. I believe that my home projects are not so complex to use this useful tool;
- . ( );
- . ( ).
Components
First, I needed to select the components for my idea. apart from the loose powder, I had nothing. To do this, I decided to use the LCSC service as a cheap and affordable option for home development. As it turned out, in many ways I entered the top of the top. For example, I used all the legs of the microcontroller, stored in 6kB of RAM, of which 4kB took a buffer for transferring data from USB to SPI Flash, I used legs for USB which are not physically on this controller, etc.
As a result, the price came out as follows:
STM32F070F6 microcontroller -0.64 $
Winbond W25Q32 serial flash memory - $ 0.35
Downconverter LP3992-33B5F - $ 0.04
Static protection USBLC6-2SC6 -0.08 $
Quartz - $ 0.15
I used resistors and capacitors in the form factor 0603, LEDs 0805. I already had all this, so it is not possible to calculate their cost. However, it is safe to say that for the price, everything fit in $ 1.5 with a margin. It doesn't look cheap compared to Hilliard's project, but my prices aren't wholesale either.
Printed circuit board and circuitry I designed the circuit
and printed circuit board in Altium designer, I attach the screenshots.
All components are tied according to datasheets. The flash memory microcircuit is started from the controller through the MIS transistor.
The USB connector was the problem here. According to the USB specification, it has a thickness of 2mm. A board of this thickness is expensive to order, and it is not very practical for a business card. I saw a way out of the situation from one personwho made a musical business card. He used a 1mm board, and made an additional connector on it, which comes off and soldered over the main one. I did the same.
Soldering
Soldering the components was generally not a problem. I sealed everything with a hairdryer and solder paste. The only problem for me was the soldering of the microcontroller. From the solder paste, too many blots were obtained, it is difficult to solder such legs with a soldering iron. In the end, I just missed all the pads with solder, and then soldered the microcontroller with a hairdryer.
Programming
I have nothing special to say here, I programmed everything at a low level, in the C ++ language. I attach the source code . I addressed the registers by articleslamerok... USB is implemented using microcontroller. The flash memory chip operates on SPI over DMA at the highest speed. The diodes blink in turn by the interruption of the timer at 250ms.
Conclusion
On this I think everything, I described the main points. If you need to disclose something in more detail (programming USB, Flash or circuitry), then write, I will definitely do it.
All the best!