ATMega 328P Based PWM controller Card

As part of my recent ESP-12E I2C Base Board project, I designed an ATMega 328P Based PWM controller card, that can be used as an add-on card with the existing project, or standalone as a custom Arduino Nano compatible development board.

What is on the PCB?

The PWM controller card contains standard Arduino Nano circuitry running at 16MHz, without the USB to Serial converter, as well as a 3v to 5v level converter on the I2C port ( A4 and A5 ), as well as another 12v to 5v level converter, with a build in resistor-divider circuit, used to drive a 12v blower with 3.3v PWM control circuitry.

All analog inputs are broken out to make attaching additional sensors easier.

All the other unused GPIO pins are also broken out, either directly to headers on the PCB (D6~,D7,D8,D9~), D11,D12,D12 (ISCP Header) and D3 ( Marked RPM on the Fan Header)

Most of these pins are also additionally broken out onto the 2x20p female header at the bottom of the card ( See schematic for more details)

The board is designed to be powered from 12v DC (via the VIN pins on the 2x20p header) which is internally regulated down to 5v via an LDO voltage regulator.


External 3.3v should also be supplied to the 2x20Pin header to enable the I2C level converters on the same header. I2C is not directly broken out onto the PCB in this version of the PCB.

A reset button, and power led, as well as the standard led on D13 is also provided.

Manufacturing the PCB


Over the past eight years, PCBWay has continuously upgraded their MANUFACTURING plants and equipment to meet higher quality requirements, and now THEY also provide OEM services to build your products from ideas to mass production and access to the market.


The PCB for this project has been manufactured at PCBWay.
Please consider supporting them if you would like your own copy of this PCB, or if you have any PCB of your own that you need to have manufactured.

PCBWay

If you would like to have PCBWAY manufacture one of your own, designs, or even this particular PCB, you need to do the following…
1) Click on this link
2) Create an account if you have not already got one of your own.
If you use the link above, you will also instantly receive a $5 USD coupon, which you can use on your first or any other order later. (Disclaimer: I will earn a small referral fee from PCBWay. This referral fee will not affect the cost of your order, nor will you pay any part thereof.)
3) Once you have gone to their website, and created an account, or login with your existing account,

4) Click on PCB Instant Quote

5) If you do not have any very special requirements for your PCB, click on Quick-order PCB

6) Click on Add Gerber File, and select your Gerber file(s) from your computer. Most of your PCB details will now be automatically selected, leaving you to only select the solder mask and silk-screen colour, as well as to remove the order number or not. You can of course fine-tune everything exactly as you want as well.

7) You can also select whether you want an SMD stencil, or have the board assembled after manufacturing. Please note that the assembly service, as well as the cost of your components, ARE NOT included in the initial quoted price. ( The quote will update depending on what options you select ).

8) When you are happy with the options that you have selected, you can click on the Save to Cart Button. From here on, you can go to the top of the screen, click on Cart, make any payment(s) or use any coupons that you have in your account.

Then just sit back and wait for your new PCB to be delivered to your door via the shipping company that you have selected during checkout.

VC-01 and VC-02 Offline Voice Module

In a recent article, I took a look at the new VC-01 and VC-02 Voice offline voice modules from AI-Thinker. I mentioned that I was working on a very simple prototype PCB to do some more tests, as well as make practical use of the module in real life.

In this very short post, I will show off the initial prototype that I came up with.
While I have to admit that it is still in an extremely basic stage, It is already definitely useful.

Part of the reason for this is that there is not a lot of information available on the VC-01 and VC-02 at this stage, as well as the fact that more exotic features like I2C and SPI are still not accessible in the current firmware. I thus had to work with what was available, as well as take into consideration what will work with the standard factory firmware as well.

The prototype carrier PCB will thus only have two optically isolated relays and their supporting circuitry. I intend to actually use the PCB in my EE LAb area to control some of the lights in the area.

The Schematic

The schematic shows the relay control circuitry, comprising of my standard optic isolator-based relay driver, as well as headers to accept the VC-01 or VC-02 offline voice module kit PCB.

Testing the PCB

The PCB was tested using the standard factory firmware, as well as my custom firmware, kindly provided by AI-Thinker. Below is a short video of that in action. Please note that the relays was not yet connected to any external devices at this stage.

Manufacturing the PCB


Over the past eight years, PCBWay has continuously upgraded their MANUFACTURING plants and equipment to meet higher quality requirements, and now THEY also provide OEM services to build your products from ideas to mass production and access to the market.


The PCB for this project has been manufactured at PCBWay.
Please consider supporting them if you would like your own copy of this PCB, or if you have any PCB of your own that you need to have manufactured.

PCBWay

If you would like to have PCBWAY manufacture one of your own, designs, or even this particular PCB, you need to do the following…
1) Click on this link
2) Create an account if you have not already got one of your own.
If you use the link above, you will also instantly receive a $5 USD coupon, which you can use on your first or any other order later. (Disclaimer: I will earn a small referral fee from PCBWay. This referral fee will not affect the cost of your order, nor will you pay any part thereof.)
3) Once you have gone to their website, and created an account, or login with your existing account,

4) Click on PCB Instant Quote

5) If you do not have any very special requirements for your PCB, click on Quick-order PCB

6) Click on Add Gerber File, and select your Gerber file(s) from your computer. Most of your PCB details will now be automatically selected, leaving you to only select the solder mask and silk-screen colour, as well as to remove the order number or not. You can of course fine-tune everything exactly as you want as well.

7) You can also select whether you want an SMD stencil, or have the board assembled after manufacturing. Please note that the assembly service, as well as the cost of your components, ARE NOT included in the initial quoted price. ( The quote will update depending on what options you select ).

8) When you are happy with the options that you have selected, you can click on the Save to Cart Button. From here on, you can go to the top of the screen, click on Cart, make any payment(s) or use any coupons that you have in your account.

Then just sit back and wait for your new PCB to be delivered to your door via the shipping company that you have selected during checkout.

True OFFLINE Voice Assistant

Most of us are familiar with voice assistants these days; Google Assistant, Siri and Alexa are obviously the most well-known of these. They all share a common problem though: They are online, and can thus secretly record everything you say around them, for later use by their respective owners [ The Companies that created them ]. Having a true offline voice assistant can thus seem like the holy grail for privacy and security-minded people.

Introducing VC-01/VC-02

I was recently contacted by AI-Thinker and asked if I was interested to play with a new product of theirs, an offline voice module. I immediately jumped at the opportunity, as this was something that I wanted to get my hands on for a long time, providing it works of course…

AI-Thinker’s offline voice module is available in two models, the VC-01 and the VC-02.

My Sales Representative (Kat ) sent me both models, in a kit format, complete with speaker and microphone. The kit PCB also provides a USB port with a ch340 chip, as well as two push buttons (reset and wake-up) as well as 3 built-in LEDs ( White, Orange and Blue ).

These light up with the factory firmware, depending on what commands are issued to the device…

Let us take a look at how the factory firmware works; Thank you to Kat from Ai-Thinker for uploading the video, and sending the link to me 🙂

As we can see in the video above, the module seems to work very well… The question now arises if it can be customised to do what we want it to…

Custom Firmware – Do-able, but with a few caveats

Information in English on this module is very sparse. This is due to it being very new, and with AI-Thinker focusing most of their efforts for this module on the Chinese market for the time being. Which makes sense in one way, but also doesn’t in another.

After spending quite a bit of time trying to get information, my Sales Rep eventually gave me access to an online configuration utility, now be warned:
This is not for the faint of heart. The entire interface is in Chinese ( They are working on an English version, with time-to-completion between one (1) to four(4) weeks from starting the project. I can however not give any accurate dates at this stage, but was told that this development is underway).

Being no stranger to different languages, I thought to use google translate to translate the website. No, that didn’t work. Google refuses or the Chinese Website doesn’t allow it to? No answer as of yet. Any readers who do know any reasons for this, please comment below.

I was sort of successful in manually copy pasting line by line into google translate and got some translation back, but it was not very useful.

My next point to try was asking AI-Thinker to generate some firmware with the web tool. They gladly did that, and that works great. It is however not feasible in the long term to go that route every time.

This was possible because the AI-Thinker engineers, using the firmware development software, currently only available in Chinese, can set custom wake words and train voice commands with a 95% accuracy rate, before generating firmware and flashing it onto the respective module.


Write your own, someone will obviously say, and that was my next attempt. There is an API, and source code on GitHub, as well as Gitee ( The Chinese version of GitHub) The two sources are however not synced, and I was still not successful in getting anything useful from Gitee, once again due to a language issue, as well as the fact that some of the sources depend on 32bit dependencies for Ubuntu, whereas I am running a 64bit version… I did try it though, and can not report any success on that venture at all.

Once again, I will advice us all to wait for AI-Thinker to release an English version of the SDK and API for us all to use, which I am sure they will do at some stage in the near future.

See the video below of my custom firmware, once again demonstrated by Kat from AI-Thinker

Custom Firmware – Test 01

As we can see, it once again performs well, with a few issues, but quite acceptable…

Hardware access to the real world

As we have just seen in the video, there is also hardware access via pins, to the real world. There are however a few issues there as well…

Hardware pins are limited.
I2C and SPI, although advertised, are apparently not yet supported in any of the current firmware – Someone with information, please comment…

While there are 2 I2C interfaces, they can not be used at the same time
Information on the module

PCB Prototype – Of my own design

As a proof of concept, I have decided to design a quick prototype with relays to use as a more detailed test. I will update information on that soon…

My Conclusion

I definitely see potential here. This is a product which can be quite useful in the future, providing that the following is done:

Proper detailed documentation is provided in English as well as Chinese
API and SDK access is made available in English as well as Chinese
Firmware be updated to make all features available

Having said all of that, I do understand that development, and especially R&D do take a lot of time. Translating documents accurately does too.

I want to congratulate AI-Thinker on producing a very well-made unit, that will definitely bring the dream of a totally offline voice assistant a little bit closer to being a reality.

Voice recognition with my bastard South-African/British English Accent, heavily influenced by Afrikaans, went extremely well, even with the factory firmware.
I do thus not think anybody that can speak passable English will have a problem using the unit.


ESP-12E I2C Base Card

As a follow-up on the ESP-12E Card, today we will look at the prototype base card that this was designed to slot into – The ESP-12E I2c Base Card.

Initial Features ( To be expanded in future versions )

4 x 40Pin Expansion slots, with access to 12v, 3.3v and Gnd on each slot.
2 x “IRQ” pins per slot ( serviced by a single PCF8574 )
I2C bus access on each slot (3.3v )
UART Header
Reset and Flash Header
GPIO Header ( Direct access to the ESP-12E GPIO Pins )
Analog Input Header (a Single input – A0, as per ESP-12E limitation)
Buck Converter Power Supply Module, capable of up to 2A of current

ESP-12E I2C Base Card – Top view

The Schematic

Schematic

The PCB – some pictures

ESP 12-E Card with Base Board

Manufacturing the PCB


Over the past eight years, PCBWay has continuously upgraded their MANUFACTURING plants and equipment to meet higher quality requirements, and now THEY also provide OEM services to build your products from ideas to mass production and access to the market.


The PCB for this project has been manufactured at PCBWay.
Please consider supporting them if you would like your own copy of this PCB, or if you have any PCB of your own that you need to have manufactured.

PCBWay

If you would like to have PCBWAY manufacture one of your own, designs, or even this particular PCB, you need to do the following…
1) Click on this link
2) Create an account if you have not already got one of your own.
If you use the link above, you will also instantly receive a $5 USD coupon, which you can use on your first or any other order later. (Disclaimer: I will earn a small referral fee from PCBWay. This referral fee will not affect the cost of your order, nor will you pay any part thereof.)
3) Once you have gone to their website, and created an account, or login with your existing account,

4) Click on PCB Instant Quote

5) If you do not have any very special requirements for your PCB, click on Quick-order PCB

6) Click on Add Gerber File, and select your Gerber file(s) from your computer. Most of your PCB details will now be automatically selected, leaving you to only select the solder mask and silk-screen colour, as well as to remove the order number or not. You can of course fine-tune everything exactly as you want as well.

7) You can also select whether you want an SMD stencil, or have the board assembled after manufacturing. Please note that the assembly service, as well as the cost of your components, ARE NOT included in the initial quoted price. ( The quote will update depending on what options you select ).

8) When you are happy with the options that you have selected, you can click on the Save to Cart Button. From here on, you can go to the top of the screen, click on Cart, make any payment(s) or use any coupons that you have in your account.

Then just sit back and wait for your new PCB to be delivered to your door via the shipping company that you have selected during checkout.

ESP-12E Card

A few months ago, I started working on an MCU Card design, which borrows from the idea of a standard desktop PC, in which there are a main-board, MCU and expansion slots, to add and remove peripherals as needed quickly.

The ESP-12E Card is a continuation of that project, with the ultimate goal to have a universal “main-board” that can accept various MCUs and standardised “expansion modules” that perform a specific task.

ESP-12E Card
ESP-12E Card

The PCB

The ESP-12E Card contains the bare minimum components to allow the chip to function. There are no power regulators or USB-to-TTL converters onboard. Code is flashed via an external USB-to-TTL converter, with Flash and Reset buttons on the actual PCB, or available in the 2×20 Pin female header at the bottom of the card.

Most of the GPIO is also broken out to the 2×20 pin header, with the exception of the 6 GPIO that is usually connected to the internal Flash on the ESP-12E module.

I have made provision for enough power and ground pins on the header as well.

As far as GPIO is concerned, They have been grouped together by function, as much as possible at least, to make interfacing with the base-board as easy as possible.

The Schematic

ESP-12E Card Schematic

The schematic is not complicated. It is a standard ESP-8266 configuration, with all non-essential components removed.

The “base-board” ( a sneak preview )

Sneak preview of the Base Card

In a future article, I will tell you more about this ( for the time being limited to I2C ) base card. [ a quick explanation: When I mean limited to I2C, it relates to the fact that at the moment, the base card, ( a prototype ) can only communicate back to the MCU via I2C protocol from each of the expansion slots, as well as via two dedicated IRQ lines from each slot ]Power is supplied via a small SMPS module.

Manufacturing the PCB


Over the past eight years, PCBWay has continuously upgraded their MANUFACTURING plants and equipment to meet higher quality requirements, and now THEY also provide OEM services to build your products from ideas to mass production and access to the market.


The PCB for this project has been manufactured at PCBWay.
Please consider supporting them if you would like your own copy of this PCB, or if you have any PCB of your own that you need to have manufactured.

PCBWay

If you would like to have PCBWAY manufacture one of your own, designs, or even this particular PCB, you need to do the following…
1) Click on this link
2) Create an account if you have not already got one of your own.
If you use the link above, you will also instantly receive a $5 USD coupon, which you can use on your first or any other order later. (Disclaimer: I will earn a small referral fee from PCBWay. This referral fee will not affect the cost of your order, nor will you pay any part thereof.)
3) Once you have gone to their website, and created an account, or login with your existing account,

4) Click on PCB Instant Quote

5) If you do not have any very special requirements for your PCB, click on Quick-order PCB

6) Click on Add Gerber File, and select your Gerber file(s) from your computer. Most of your PCB details will now be automatically selected, leaving you to only select the solder mask and silk-screen colour, as well as to remove the order number or not. You can of course fine-tune everything exactly as you want as well.

7) You can also select whether you want an SMD stencil, or have the board assembled after manufacturing. Please note that the assembly service, as well as the cost of your components, ARE NOT included in the initial quoted price. ( The quote will update depending on what options you select ).

8) When you are happy with the options that you have selected, you can click on the Save to Cart Button. From here on, you can go to the top of the screen, click on Cart, make any payment(s) or use any coupons that you have in your account.

Then just sit back and wait for your new PCB to be delivered to your door via the shipping company that you have selected during checkout.

iPCB-DFM – Intelligent PCB DFM

(Design for Manufacturability) Gerber Software Analyser

Free to Use for all PCBpartner.com Users

PCBPartner.com recently decided to release their own DFM software, which I believe they developed in-house and use themselves every day, to their customers, in order to enable their customers to design better PCBs and increase the overall quality and service satisfaction.

In this article, I will give the software a quick look and feel, and show you some of its features, while at the same time admitting upfront, that it is quite complex, and that I am also not quite well acquainted with it myself, having only a few days to play with it up to now.

What is DFM?

DFM (Design for manufacturability) analysis of incoming Gerber files is a standard and important process in any PCB factory. iPCB-DFM’s purpose is to perform this process automatically to find potential production issues with your PCB design, saving time and effort for you the PCB designer, and the PCB manufacturing engineers who are going to produce your PCB. Based on 25 years of PCB manufacturing experience, we have a massive collection of PCB DFM rules built into this software, allowing it to analyze up to 24 kinds of specifications.

It also has powerful features such as quick panalization, PCB simulation and direct Gerber editing, and can even help you count how many SMD pads are in your design!

Why do you need iPCB-DFM?

If you’re an electronic engineer, you don’t want to send your PCB Gerber files for manufacturing without checking that your design and file formats match your factory’s production capability; If you are a purchasing manager without much knowledge of PCB manufacturing processes, this tool can help you better understand the specifics of the PCBs you are ordering, making it much easier to communicate with your PCB suppliers.

What Features does this DFM have?

Gerber file view supports Gerber274x, Excellon, ODB++ and IPC-2581 formats
-Measuring
-Layer management
-Auto recognize layers (silkscreen, solder mask, copper, solder paste, inner layers)

-PCB simulation:
generate a simulated preview of your PCB, updated in real-time by different colour settings and surface finishes, and supporting high-resolution PNG output format.



DFM Functions

1 Layer
2 Dimension
3 Minimum trace space
4 Minimum trace width
5 Hole diameter
6 Drill slot
7 Through-hole annular ring
8 Hole distance
9 Hole to trace
10 Copper to edge
11 Special holes
12 SMD size
13 Via in pads
14 Test Point
15 Component solder pads number
16 Via density
17 Surface finish area (%)
18 Routing length of travel
19 Grid wiring
20 Solder mask
21 Fiducial Point
22 SMD pad size
23 SMD pad space
24 BGAs

Gerber Edit

1 Add elements
2 Delete elements
3 Move elements
4 Copy elements
5 Adjust circuit angle
6 Rotate elements
7 Edit trace
8 Mirror
9 Positive and negative switch
10 Break trace
11 Shape edit
12 Single, rectangular marquee, polygon selection

Panelization
Quick panelization
– set a panelization style, tooling bar width and board space,
one click to generate a panalized board in seconds in Gerber format.
Advanced panelization – allows you to adjust tooling hole, v-cut, fiducial mark, solder mask for fiducial mark, drill holes on tooling bar, etc.

What does it need to run?

For the foreseeable time forward, the software only runs on Microsoft Windows. It apparently supports from Windows XP right up to Windows 11, but I only had success on Windows 10, ( I don’t have Win 11).

This was also done in a VM running in Oracle Virtualbox on an Ubuntu 22.04 LTS host. (My main operating system)
Specifications for the VM were 4Gb RAM and a 50Gb Hard Disk. I have also tested it with 8Gb, but it did not make any real difference to the performance.
(This is most definitely NOT related to the DFM software, but more likely to be attributed to a certain heavy resource-consuming operating system (Win 10 – which as most of us know by now, is super slow whatever you give it to run on)

Installation

Installation is straightforward and quite easy, as we can expect from any Windows software these days

Getting Started

The software starts up pretty quickly, but the gets a bit of a slowdown with a login prompt tying back to PCBPartner, where you have to enter your login credentials. This can take a bit of time to actually appear.

I am hopeful that this process will in time be streamlined as I believe that the number of users on the system will grow quite fast…

Let us look at some pictures of the UI and Menu Systems

The software also comes with a very detailed Helpfile in .pdf format

My thoughts on all of this

This is an extremely complex piece of software. It is also extremely powerful, and can thus be very very useful to all of us. The learning curve is extremely steep, but I do believe that it will be possible to learn and use it effectively.

As a Linux user, I would also like to see a Linux version, or at least an in-browser version, similar to a well-known EDA software package. The days that software should be confined to one operating system should be behind us ( at least in my personal view, I find it very frustrating that most other commercial CAD, CAM and EDA packages are actively forcing us to stay with one of the slowest operating systems available )

I also want to thank PCBPartner for giving me the opportunity to review and take this for a test drive. I would only have wanted to be more adept at actually getting value out of a great piece of software, but I believe that I will definitely get better at it over time.

Robotic Toy Car – Part 6

Today we will look at the remote control unit for the Robotic Toy Car – Part 6.
The project is close to being completed, and as such, there are quite a lot of final things that need to be taken care of.

One of these will definitely be the final coding, which I will release in the final part of the project, so with that in mind, let us take a look at the remote control unit.

Remote Control Unit, designed to be used with ESP-Now

I have decided to do something completely different from standard remote control units, being that I will use ESP-Now, a protocol developed by Espressif.
ESP-Now runs on the Wifi hardware of the ESP8266 or ESP32 and is basically a peer-to-peer protocol, that does not require Wifi but can co-exist with it on the same device. Outdoors, ESP-Now has a range of about 100m, which should work very well for my intended use.

The Remote control, as designed, will have 4 dedicated buttons: forward, reverse, left and right, divided into two groups to make two-handed control easier, similar to a standard game controller. No input on either of the two groups will result in stopping the vehicle, in the case of forwards and backwards, and centring the steering, in the case of the left-right axis.

a 3D Rendered Image of the PCB, motion axis on SW1 and SW2, steering axis on SW3 and SW4

As I always try to make my designs somewhat reusable for other purposes, I have also broken out most of the unused GPIO pins to header pins, with also adding a jumper on GPIO16 to make deep-sleep wakeup mode possible., You can also re-use the switch pins for other purposes, just remember to first remove the 10k pull-up resistors at R14, R15, R16, and R17…

SW4 -> R16 , SW4 = GPIO4
SW3 -> R17 , SW3 = GPIO5
SW2 -> R15 , SW2 = GPIO13
SW1 -> R14 , SW1 = GPIO12

GPIO16 can be reused as well, just remove the jumper, but remember that it is pulled up through a LED and a 470ohm resistor…



There is no USB-to-serial converter onboard, I have been having quite a lot of headaches with them over the last few months, with almost all CH340G chips that I have purchased, being fake, or dead-on arrivals that don’t work… Sending them back to the suppliers, unfortunately, results in unpleasantries, because even placing them in verified working circuits, still proves them to be not working… This is however not an issue, as it is quite easy to upload the board with an external adapter.

The Schematic

Schematic Diagram

Manufacturing the PCB


Over the past eight years, PCBWay has continuously upgraded their MANUFACTURING plants and equipment to meet higher quality requirements, and now THEY also provide OEM services to build your products from ideas to mass production and access to the market.

The PCB for this project has been manufactured at PCBWay.
Please consider supporting them if you would like your own copy of this PCB, or if you have any PCB of your own that you need to have manufactured.

PCBWay

If you would like to have PCBWAY manufacture one of your own, designs, or even this particular PCB, you need to do the following…
1) Click on this link
2) Create an account if you have not already got one of your own.
If you use the link above, you will also instantly receive a $5USD coupon, which you can use on your first or any other order later. (Disclaimer: I will earn a small referral fee from PCBWay. This referral fee will not affect the cost of your order, nor will you pay any part thereof.)
3) Once you have gone to their website, and created an account, or login with your existing account,

4) Click on PCB Instant Quote

5) If you do not have any very special requirements for your PCB, click on Quick-order PCB

6) Click on Add Gerber File, and select your Gerber file(s) from your computer. Most of your PCB details will now be automatically selected, leaving you to only select the solder mask and silk-screen colour, as well as to remove the order number or not. You can of course fine-tune everything exactly as you want as well.

7) You can also select whether you want an SMD stencil, or have the board assembled after manufacturing. Please note that the assembly service, as well as the cost of your components, ARE NOT included in the initial quoted price. ( The quote will update depending on what options you select ).

8) When you are happy with the options that you have selected, you can click on the Save to Cart Button. From here on, you can go to the top of the screen, click on Cart, make any payment(s) or use any coupons that you have in your account.

Then just sit back and wait for your new PCB to be delivered to your door via the shipping company that you have selected during checkout.


Robotic Toy Car – Part 5

In this almost post we look at the power distribution PCB for the almost completed Robotic Toy Car. I had many interesting issues to solve here, especially since I did not design my own Lipo battery charger circuit, but used a very useful little commercially available unit instead, the MH-CD42

Based on a relatively difficult chip to get information on, the module is basically an integrated Lipo charge/discharge module, with a built-in boost converter that provides 5v at a maximum of 2A current. What makes it special is the ability to simultaneously provide current and voltage, as well as charge the attached LiPo cell at the same time, when connected to an external charger.

It does, however, in my view at least, also have a few serious flaws, the most irritating of these being that it will completely discharge the attached LiPo cell even when completely switched off…

I have thus tried to stop this issue from occurring by adding a switch in line with the Lipo Cell, a quite obvious solution, but it should not have been needed if the chip functioned as intended… ( As far as I can gather, the module was originally designed to be used in USB power banks. This makes the flaw even more serious, as a self-discharging power bank really defeats the purpose)

Enough of that though, when it does work, it works great. just remember that you can not apply more than 5.5v DC to the charging input of the module.

The completed Power Distribution and charging module

The Schematic

There is actually not a lot going on here, as everything is already on the supplied module. I have just added a charging port, additional power headers for 5v output and ground, as well as direct access to the LiPo Cell output, and a switch header to cut off power to the MH-CD42 when it is not in use.

The PCB

The PCB was manufactured as a 2-layer FR-4 board. The entire top layer is used as a ground plane, and the bottom layer was used for the 5v and Vbat traces, which were made as big as possible to allow for the high current ( up to 2A ) that the unit can supply to a load.

The TOP later of the PCB is a complete ground plane.
The BOTTOM Layer caries only power traces for 5v and VBat
a 3D Render of the PCB, showing header pins and other connections

It is also worth mentioning that the VBAT pins are NOT 3.3v ( Remember that the LiPo cell can run from 4.2v down to 3.0v depending on the charge. These headers were only placed on the board to provide direct access to the LiPo cell, for use with for example an ADC input or for connection to a dev board that is already fitted with a buck converter or a suitable LDO voltage regulator.

The Actual PCB, as received from PCBWay
Top Layer of the PCB
Bottom Layer of PCB

Manufacturing the PCB


Over the past eight years, PCBWay has continuously upgraded their MANUFACTURING plants and equipment to meet higher quality requirements, and now THEY also provide OEM services to build your products from ideas to mass production and access to the market.

The PCB for this project has been manufactured at PCBWay.
Please consider supporting them if you would like your own copy of this PCB, or if you have any PCB of your own that you need to have manufactured.

PCBWay

If you would like to have PCBWAY manufacture one of your own, designs, or even this particular PCB, you need to do the following…
1) Click on this link
2) Create an account if you have not already got one of your own.
If you use the link above, you will also instantly receive a $5USD coupon, which you can use on your first or any other order later. (Disclaimer: I will earn a small referral fee from PCBWay. This referral fee will not affect the cost of your order, nor will you pay any part thereof.)
3) Once you have gone to their website, and created an account, or login with your existing account,

4) Click on PCB Instant Quote

5) If you do not have any very special requirements for your PCB, click on Quick-order PCB

6) Click on Add Gerber File, and select your Gerber file(s) from your computer. Most of your PCB details will now be automatically selected, leaving you to only select the solder mask and silk-screen colour, as well as to remove the order number or not. You can of course fine-tune everything exactly as you want as well.

7) You can also select whether you want an SMD stencil, or have the board assembled after manufacturing. Please note that the assembly service, as well as the cost of your components, ARE NOT included in the initial quoted price. ( The quote will update depending on what options you select ).

8) When you are happy with the options that you have selected, you can click on the Save to Cart Button. From here on, you can go to the top of the screen, click on Cart, make any payment(s) or use any coupons that you have in your account.

Then just sit back and wait for your new PCB to be delivered to your door via the shipping company that you have selected during checkout.

Fix Driver Issues with CH340G on Ubuntu 22.04 LTS ( and possibly other Linux Distro’s)

Having recently upgraded to Ubuntu 22.04 LTS ( After the local power-company managed to destroy my HP ML350-G6 server, with a UPS installed, with a power surge or something – still no answers — 🙁 ) on a new more modern Desktop computer, I found some intermittent issues with my ESP32 / ESP8266 and Arduino boards… The Serial port would not work at all ( on devices with CH340G chips )…

A quick online search found the following, link to the original article here,

Instructions for Ubuntu 22.04 LTS x86_64

Get the currently installed kernel version:

sudo apt-get update -y
sudo apt-get install neofetch -y
neofetch

I think it came with Kernel: 5.13.8-...

Install latest kernel (GUI solution):

sudo add-apt-repository ppa:cappelikan/ppa
sudo apt-get update -y
sudo apt-get install mainline -y
sudo apt autoremove -y

Run mainline and select the latest kernel (I tried, as of 16/05/2022, kernel version: 5.17.8-051708-generic)

After installation and reboot, run neofetch again and check if the latest linux kernel is loaded.

Install build tools (if not installed already):

sudo apt-get update -y
sudo apt-get install build-essential dwarves dkms make cmake -y
sudo apt autoremove -y

Install and fix CH34x drivers:

As per the guide here in sparkfun and https://github.com/juliagoda/CH341SER

git clone https://github.com/juliagoda/CH341SER
cd CH341SER
sudo make clean 

# The Makefile looks for vmlinux in a certain location (check that cat Makefile)
# we need to move that
# https://forum.proxmox.com/threads/kernel-module-not-found-when-compile-skipping-btf-generation.100974/
cp /sys/kernel/btf/vmlinux /usr/lib/modules/`uname -r`/build/

sudo make
sudo make load
lsmod | grep ch34*

# NOTE: if other/prev ch34x drivers are loaded (and you know they were not working), then you can unload them by:
sudo rmmod ch34x

# Plug and unplug your CH340 device again on the USB port
sudo dmesg

# plug un-plug your device and then verify:
ls /dev/tty*

# make it accessible
sudo usermod -a -G dialout $(whoami)
sudo chmod a+rw /dev/ttyUSB0 # if /dev/ttyUSB0 was assigned

# To unload:
sudo rmmod ch34x
# or 
sudo make unload

Disable some conflicting services.

It came out during my test, at least on my machine, a service for some external brail hardware was conflicting with the drivers. I saw that in sudo dmesg

... ch340 1-10:1.0: ch341-uart converter detected
... usb 1-10: ch341-uart converter now attached to ttyUSB0
.
.
.
... usb 1-10: usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1
... ch340-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0

It was apearing and dis-appearing. so I tried to hunt the service as such:

sudo systemctl list-units | grep brltty

I then disabled it:

sudo systemctl stop <brl service name or other service that is interfering and not needed>
sudo systemctl disable <brl service name or other service that is interfering and not needed>
sudo systemctl mask <brl service name or other service that is interfering and not needed>

for f in /usr/lib/udev/rules.d/*brltty*.rules; do
    sudo ln -s /dev/null "/etc/udev/rules.d/$(basename "$f")"
done
sudo udevadm control --reload-rules

Robotic Toy Car – Part 4

In this part of the series, Robotic Toy Car – Part 4, We will add some custom side-panels to the project. While the original toy did come with some laser cut aluminum side panels, I decided to replace them with PCB versions, with even more flashing lights (yes, this thing is turning into a “Christmas tree” , but that is what the eventual owner wanted… )

These side-panels will not be programmable. They will simply be operated from a standard 555 timer and a couple of other components, to give a flash time of about one second on and off each…

It is also an excellent project to showcase the capabilities of PCBWay, in dealing with a “rather difficult” PCB to manufacture. As you may know by now, I use PCBWay‘s services quite extensively, and I also only design my PCB’s with EasyEDA. EasyEDA is however quite limited in some aspects, and as far as myself, making panels of different designs on one PCB with complex shapes is not something that I do every day…

Let us take a look at what had to be done, and how well it was manufactured…

The PCB Layout

What we have here, is basically two mirrored side-panels ( as far as the visible “outside” is concerned anyway ) That consists of 6 led’s per side that will flash alternatively. On the “inside” we have a 555 timer chip, with some resistors and capacitors, as well as transistors that does the switching.

The Schematic

The difficulty of this PCB is definitely in the manufacturing. I was however pleasantly surprised with the excellent work that was done by PCBWay. Their Engineering staff did contact me early on in the order, with a suggested plan to manufacture, and once I approved that, they very quickly went on to production. My initial concern was that they suggested “mouse-bites” which we all know can sometimes come out a bit strange…

Completed PCB in packaging..

I was however extremely pleased when the above parcel arrived… They added side rails, and the “mouse-bytes” were super tiny.

After assembly ( not cleaned up yet )
After Assembly ( not cleaned up yet )
Installed on the toy car body

The “almost completed ” Robotic Toy Car

With the completion of the side-panels, it was also time to start work on the power wiring and other essential components of the project, which will get their own detailed post in a few days.

the “almost completed” project

Some details on the construction:
The toy originally came with a single 500mA 14500 cell, which unfortunately stopped working very soon after only a few uses… This was however one of the reasons why the entire project happened in the first place, so no complaints there.

I decided to replace it with a 18560 cell with a capacity of about 1900mA. This cell is much bigger however, and I had to think of where to place it. I decided to put it on the roof, sort of emulating a “spoiler”.

Some of the next parts of the project will be the remote control unit, which will basically be an ESP8266 running ESP-Now protocol, as well as a decent battery charging and power distribution circuit, that will protect the Lipo cell from over charging and discharging, as well as provide sufficient power for all the added electronics in the toy car.

“But you said it was Robotic, so why have a remote control?”

The initial plan for the project did indeed say robotic, but it is also designed to be a learning platform, especially to teach coding. With that in mind, it is definitely better to keep things simple for now, and add sensors and more capabilities later on, especially as I am actually planning to replace the main MCU board with a more powerful ESP32 in a next version anyway.

The car body is also extremely cramped, and does not have any space for mounting sensors at all. I plan to remedy that by designing and 3d-printing a whole new custom body shell later… providing that my young friend actually stays interested enough to learn the coding… If he doesn’t, he will as least have a very interesting looking custom remote controlled toy car.

Manufacturing the PCB

The PCB for this project is currently on its way from China, after having been manufactured at PCBWay.
Please consider supporting them if you would like your own copy of this PCB, or if you have any PCB of your own that you need to be manufactured.

PCBWay

If you would like to have PCBWAY manufacture one of your own, designs, or even this particular PCB, you need to do the following…
1) Click on this link
2) Create an account if you have not already got one of your own.
If you use the link above, you will also instantly receive a $5USD coupon, which you can use on your first or any other order later. (Disclaimer: I will earn a small referral fee from PCBWay. This referral fee will not affect the cost of your order, nor will you pay any part thereof.)
3) Once you have gone to their website, and created an account, or login with your existing account,

4) Click on PCB Instant Quote

5) If you do not have any very special requirements for your PCB, click on Quick-order PCB

6) Click on Add Gerber File, and select your Gerber file(s) from your computer. Most of your PCB details will now be automatically selected, leaving you to only select the solder mask and silk-screen colour, as well as to remove the order number or not. You can of course fine-tune everything exactly as you want as well.

7) You can also select whether you want an SMD stencil, or have the board assembled after manufacturing. Please note that the assembly service, as well as the cost of your components, ARE NOT included in the initial quoted price. ( The quote will update depending on what options you select ).

8) When you are happy with the options that you have selected, you can click on the Save to Cart Button. From here on, you can go to the top of the screen, click on Cart, make any payment(s) or use any coupons that you have in your account.

Then just sit back and wait for your new PCB to be delivered to your door via the shipping company that you have selected during checkout.