ESP8266-12E in Arduino Form Factor

As a followup to my recent ESP32-S in Arduino Form Factor device, I decided to also produce a similar circuit board for the ESP8266-12E. Although some people mostly consider these as obsolete, I still find them extremely useful for small projects, and thus use quite a lot of them.

With their lower total pin count and similar low cost to the bigger ESP32 modules, these do force you to get quite creative with the available pins, as well as how and what you can interface.

ESP8266-12E in Arduino Form Factor, with optional I2C pullups as well as Wake from sleep function on GPIO16

What is on the PCB?

For this design, I have once again tried to keep it very lean, including the absolute bare minimum supporting components needed for correct operation.
This includes pull-up and pull-down resistors on the various strapping pins, as well as some decoupling capacitors.

I also did not include a USB-to-Serial converter circuit, as these are used only once or twice, and also consume power while not being needed all the time.
As most of my devices are uploaded OTA anyway, an external stand-alone USB-to-Serial adapter is perfect to upload the initial firmware.

Jumpers to control the onboard I2C pullup-resistors, as well as the Wake-up-from-deep-sleep function on GPIO16 were also added, in addition to the Reset and Flash push-buttons to place the device into initial programming mode.

A 3.3v LDO regulator was also added, for convenience mostly, when powering the device from a bench power supply unit. The recommended voltage for this LDO would in my opinion be 7v Dc, although the datasheet states it can be up to 15v DC… In my opinion, that stresses the component a bit much though, as most of that excessive voltage is dissipated as heat.

PCB Layout – Blank board, front and back

Blank ESP-12E Dev board PCB – Front
ESP-12E Dev board- Back

To try and minimise heat-related issues with the LDO regulator, I have incorporated an on-PCB heatsink for the LDO regulator, which is via-stiched together on both sides of the PCB. This type of heatsink seems to work quite well in many of my other designs, so I decided to use it here as well.

I have also made use of big copper pours on both sides of the PCB to ensure that there is a good ground plane, as well as make use of differential pairs for the routing of the UART and I2C tracks.

Schematic

ESP-12E Dev Board Schematic

PCB Design


Manufacturing

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.

You can get your own copy here

PCBWay

Some assembly pictures

Procedure to upload initial firmware

Due to the fact that this device does not have an onboard USB-to-UART (Serial) converter, it will be necessary to use an external device the first time that you upload firmware, or while you are using it on the bench if you do not want to use OTA…

The easiest way to do this, in my opinion, is the following:
1) Power the device from a bench power supply, set at 7V DC via the VIN and GND Pins, available on the bottom left and right of the device ( you can use either side, not both 🙂

2) Now connect your external USB-to-UART converter to the device, as follows:
UART Converter <-> ESP-12E Dev Board
Rx <- TxD
Tx -> RxD
Gnd — GnD

Do Not connect the power (VCC) from the USB-to-UART Converter!

Now start your Adruino IDE, or similar, and connect to the Serial monitor.
Press the reset button on the board, and watch for output in the serial monitor.

If you see output, at 115200 BPS, press end hold flash, and then press and let go of reset, while still holding the flash button.

Wait a few seconds, and then upload your sketch, remembering to manually reset the board after the upload has completed.

I would recommend that you upload the Arduino OTA sketch, from the examples, and modify it to connect to your local WiFi. That way, you will be able to upload all following sketches via your local Wifi, providing that you do not remove the OTA code from the sketch.



ESP32-S in Arduino Form Factor

The ESP32-S is, at least in my opinion, one of the most versatile microcontrollers available to the Maker at this moment. It ticks almost all of my boxes for features required in a microcontroller, with a lot of gpio’s, WiFi, and Bluetooth, as well as a lot of storage space for code.

I do however have an issue with it, which I usually get around by designing a custom circuit board with a specific purpose. This is great for a project, but as most projects do not start on a custom-built circuit board, I am usually required to use a breadboard module. This is where my problems start. These modules are cumbersome to fit on a breadboard, to say the least, taking up a lot of space, and leaving very little space to connect to its pins with anything else.

Some of these modules do not even fit on the breadboard, making it necessary to hang one side off the breadboard or use two breadboards with a gap in the middle. I am quite sure many people can relate to this problem.

My second issue is that when you have done your breadboarding, and want to go to a permanent project, which does not always need a dedicated PCB, you are now required to either live with things on a breadboard, scary to say the least or have a “spider” with many modules and wires, in a box or partly on protoboard etc…

My Solution, the ESP32-S DEV Board, in Arduino Uno form factor

My solution

You can get your own copy here

While not the most elegant, personally I really like the size, and layout of the humble Arduino Uno, with its standardised pinouts, and a large number of addon shields available for the platform. This made me think, sure, there are already ESP32-based boards in this form factor available commercially, but why not make my own instead, as well as a few of my most used modules in a standardised shield form, to make my life just that little bit easier?

The picture above shows my attempt, with most of the GPIO broken out onto female header pins (except for the 6 gpio that are connected to the internal flash chip on the module).

The Blank PCB ( front )
PCB- Back

The PCB explained…

Power:
The board can be powered in two ways, either via the VIN pin ( at an optimal 7.0v DC – the LDO regulator can handle up to 15v, but I personally find that to stress it a bit hard ), which will use the onboard LDO voltage regulator to provide the needed 3.3v or from an external 3.3v PSU, which can provide a bit more current if needed…

There are also plenty of 3.3v and ground connections on the two 20-way headers to connect to other sensors.

Strapping Pins
All the required strapping pins are pulled up or pulled down, as per the datasheet, to 3.3v or ground respectively.

GPIO Pins
All GPIO pins are clearly labelled on the silkscreen to make it easier to use.
I did however not stick to the Arduino labelling convention, as I don’t always use the Arduino IDE, and the actual GPIO numbers are in my view, more useful then.

Flashing code to the board

It will be quite obvious that I did not include any USB-to-serial converter on the board, the reason for this being that, in my opinion,
1) it wastes space on the board
2) it is not actually necessary, as we can upload with an external uart adapter, or use OTA ( which I actually do most of the time )
3) In an actual project, that USB port is going to attract problems, especially if you give it to someone else to use…

A simple Arduino OTA sketch is available in the examples section of the Arduino IDE. It is easy to use and modify and does not need a lot to make it useable with your own sketch…

Antenna Cutout

As recommended by the manufacturer , I have chosen to place the chip inside a cutout on the top of the PCB, with no tracks nearby.

Figure 17: Keepout Zone for ESP32 Module’s Antenna on the Base Board

Although this is not the ideal “best position”, I found that this position worked well with previous designs, and have thus kept it at that.

General comments

As this board is mainly designed for prototype development, I did not bother with dedicated power connectors etc. I did however add proper wide tracks for all the power connections, an on-PCB-heatsink for the voltage regulator, as well as proper ground planes on both sides of the PCB, connected together with via-stitching where needed.

It is also very important to note that this is a 3.3v device. If you need to use sensors or peripherals that operate at other voltages, you will have to use external level converters.

Some assembly pictures

Schematic

Manufacturing

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.

You can get your own copy here

PCBWay

A RISC-V IoT Development Board

Most of us will not know about RISC-V, or have had access to a RISC-V Chip.
This will thus be truly one of the most difficult posts I have written, due to many factors…

To name a few of these:
– The learning curve is extremely steep because there is extremely limited information available on the chip
– I can not at the moment allowed to divulge any information on the chip used, as I have received a few “sneak-preview” modules, and the manufacturer, who shall also remain anonymous for now, has not released it to the public yet.
– Most of the information available on the BL-602 ( on which the chip is based) is in relation to the BL-IOT-SDK, or Apache NuttX, an RTOS for use with microcontrollers.
While the NuttX project has excellent documentation, it is written in a very technical style, and focused on very basic, very advanced or very specific things. This will hopefully be improved upon to make it more “new-end-user-that-is-learning” friendly in future.

As most of us can no doubt see, This post is quite a challenge. I will thus focus on the PCB I designed to use with the “mystery BL-602” chip, and provide a lot of links to where you can get information on Apache NuttX, as well as how to use it with the BL-602 in general.

Once the module has been officially released, I will do a followup-post, with specific documentation etc, which, although I have already got some of it in my possession, I can not release at the moment for ethical reasons.

I think it fair to tell you all this much, and , unintentionally, have to create anticipation on what and where etc… My apologies for that, but rules are rules, and secrets are meant to be kept, until told otherwise…

So, lets get started. Some links to get you started and show you where this is going…

Apache Nuttx is the RTOS that you will most likely have to use to do anything useful with the BL-602 chip, as well as other microcontrollers, notably the ESP32-S3 and some of the STM32 chips.

Bouffalo Labs are the people behind the BL-602, as well as the BL-IOT-SDK, which will also be quite useful in designing solutions around the BL-602

Run Rust on RISC-V Firmware will provide some excellent points to get started

LEE Lup Yuen seems to be the kind person who has written most of the extensive and useful documentation on NuttX and the BL-602, amongst others…

NuttX Incubator on Github is a very detailed source, also by Mr Lee Lup Yuen, that aims to get us started with the BL-602 and NuttX – This link is HIGHLY recommended!

My Prototype PCB

Carrier PCB – Disclaimer – I have edited the silkscreen to remove Chip markings- This will be released to the public at a later stage. As mentioned above, it is necessary at this moment to keep this information confidential.

I decided to design an extremely basic, bare PCB with basically just the BL-602 chip and its supporting circuitry. This will allow me to focus only on the chip, as well as provide maximum flexibility in the future by the addition of add-on shields with specific functions. with this in mind, I purposely chose a PCB footprint similar to the Arduino UNO.

It is also worth mentioning that the chip module used on this PCB IS NOT a standard BL-602, although the footprint looks similar.

At the moment, I am however pulled between being frustrated at the lack of available information and also being excited at the possibilities that are already there or will open up in the future.

Needless to say, some people will be frustrated at the “seeming lack of details in this post”. Lets all stay calm, and remember that I will post a followup, with all the details soon.

Manufacturing

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.

RaspberryPi Pico Carrier PCB

The Rp2040 chip from the RaspberryPi foundation should be quite well known to everybody by now. Many companies have also released their own development boards based on it. The original Raspberry Pi Pico is popular, based on its small size.


For myself, there is however a serious drawback, its small size, while perfect for breadboard, made it necessary for the developers to place the pinouts on the back of the board. This makes it necessary to either memorise the pinouts or always have a pinout diagram handy when working with it.

The module also comes with castellated holes, making it ideal to place onto a custom PCB as a “component”. This got me thinking, I can easily design a custom RP2040-based PCB, but manually assembling the tiny RP2040 is something that my poor eyesight will make a bit challenging (staring at computer screens for many years does really take its toll as you get older).


Finding components in stock (excluding the RP2040) is also a challenge in my area.

This made me think about taking a popular footprint ( like the Arduino Uno ), and placing a Pico module directly onto the board, labelling all the pins clearly on the front, and installing female headers to access them.

While it is obviously not a very complicated PCB, it will definitely help me to utilise the fantastic little chip more effectively.

Assembling the PCB should only take a few minutes, as you only have to solder the pico and female header pins to the board. When completed, it should look like this:

If you have already soldered headers to your Pico, you can still use this PCB as well. You can also use the new Pico W with this board, the only difference is that the Pico W does not have castellated holes on the pins, so you would have to use header-pins. Also, the debug port now has a connector, so you will have to use the port directly on the Pico for that.

A good introduction to the new Pico-W can be found here. I have not bought any yet, so have no pictures to show, or comments to make on its operation.

What is next

I have plans to start designing a series of add-on shields with specific functions for this platform, since being freed from the breadboard, the Raspberry Pi Pico suddenly became much more interesting to me.

While smaller seems to be better in the electronics world of today, breadboarding, in my humble opinion, is quite aged, and can be extremely unreliable, due to poor connections etc. It is however very quick and fast, without requiring you to solder anything.

I am thus attempting to get the best of both worlds, by not being tied down to a breadboard, but with the freedom to go there if I choose, or just designing and using a custom shield of my choosing.

Manufacturing

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.

USB Power Supply Module

USB Ports are quite handy to power all our day-to-day electronic devices, but most charging devices are limited to a single port. While it is possible to get a commercial multi-port USB-Charger ( I have quite a few myself), they are usually limited in charging current or very cheaply made.

I decided to do my own, at this time limited to supplying power only, but with a few added features to make it my own.

Features

  • Individual switching of ports
  • Individual power LED indicator on each port, that can be left disconnected for total dark operation ( I don’t like charging lights in the bedroom )
  • Switchmode Power Supply unit, up to 2A output
  • Wide input supply options, not limited to 5v
  • Wide power tracks to ensure decent current transfer, and reduce heat generation on the PCB

Why did I choose to build my own?

We use USB ports on almost all our electronics devices, and most of the charging units that comes with these are quite badly designed. They are underpowered, have only one port, and have annoying lights that are quite bright at night.

I wanted a single unit that can accept up to 4 devices, control each port individually, as well as be relatively small and compact for travel use.

The PCB

The PCB is a double layer, with wide power tracks on opposite sides of the board. The component count is quite low, with only USB3 Type Female connectors(4), a single MP1584 Buck converter module, 4x current limiting resistors for the LED indicators, as well as male header pins for the switches and LED indicators.

The biggest challenge was to get the port spacing correct so that it will be easy to use all of them at the same time. CNC cutting the enclosure should also not be too difficult as well, once I get around to designing that in CAD/CAM

The Schematic

I have chosen to keep it simple on this revision, and only supply power via the ports. I plan to maybe do a full data-capable USB 3.0/ USB3.1 Hub later.

Manufacturing

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.

An SMD Breadboard

The electronics Breadboard is definitely one of those things that electronics hobbyists use quite a lot. It allows you to prototype your design relatively easily, with the use of breakout modules, wires and leaded components.

While this seems like a good thing, these breadboards are also unfortunately not perfect. The wires and connectors add electrical noise, and stray capacitance, as well as a certain level of unreliability.

My biggest issue with breadboards is not that though. it is the fact that you can only use through-hole components. Breakout PCBs is sort of a middle ground, as they allow you to connect SMD chips to stuff on a breadboard with wires, but that is not the issue here.

Doing a lot of prototyping, having a lot of components lying around, and then having to still try and find TH versions of everything to prototype with becomes costly in terms of time and space. If you have a larger project, but you are not yet at a stage to have a PCB made, adding another breadboard to the already cluttered setup is sometimes quite a challenge.

To get rid of this major point of frustration to me, I decided to try to solve it for myself by designing a SMD breadboard Hybrid.

What is on the board?

Quick Specifications

-300-hole solderable breadboard (dual layer, plated through-hole pads)
-64 0805 SMD pads, with plated through hole pads for connectors
-8 BJT/Mosfet footprint pads (SOT233/SOD23-3) with 3 plated through-hole pads per terminal
– 3 Power rails, 30 holes each for Vcc and Ground (Common ground on all)
– Mesh-style ground plane on both sides of the PCB.
– 4 mounting holes

Details

To address all of the various issues that I have with breadboarding, I did the following:

I hardly ever use more than a 300-hole breadboard for single stage of a project.
Many of these circuit blocks could benefit from being a permanent soldered solution, but does not warrant the time and expense to design a dedicated PCB to hold them.

The first thing to do was thus to design a 300-hole PCB breadboard, complete with top and bottom power rails.

My next issue was SMD components. Chips have many footprints, and to try and design for each of them would turn into a nightmare. Breakout PCB’s would thus still be used for those. My biggest issue was BJT’s Mosfets Capacitors, diodes and resistors.

These can be bought in lead versions, but that was exactly what I tried to get away from, so it needed some thinking.

Resistors, capacitors and diodes have only two terminals, and could thus easily be soldered onto 0805 resistor pads (depending of course on the capacitor size )

BJTs and Mosfets need their own footprint.

Each of the SMD components has a corresponding through-hole pad, to easily connect it to a different part of the board as needed. BJT’s and Mosfets have 3 per leg.

Hopefully this will make things a bit more organised in future, and save me some time;

Manufacturing

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.


ATMega328 I2C Base Board

In this planned to be a short post, I will quickly take a look at a scaled-down version of the ESP-12E I2C Base Board. This one in particular has only two slots, without the dedicated ESP-Card slot.

The main reason for this PCB is that the original version was designed for easy prototyping and projects where enclosure space will not be an issue. This is especially true in the case of the actual project that this will be used in, as there are quite a lot of other, very bulky components, that all need to be fitted into a relatively small enclosure.

What is on the Board?


The board contains two 2×20 Pin Male Header slots, providing 12v, 3v, Ground and access to the I2C bus, as well as additional GPIO’s as provided by the module plugged into the slot. I have also decided to provide breakout access to these IO’s on the actual PCB.

This is a feature that was not yet implemented on the original prototype.
Additional Ground connections, as well as an I2C expansion port, used to interconnect to other Base Card modules were also added.

It is also important to note that the I2C bus is powered by 3v. Interface modules should take this into consideration ( mine does ).

Power is provided by an MP1584 Buck converter module.

What has Atmega328p to do with it?

I called it ATMega I2C Base Module due to the fact that I plan to design a custom ATmega328P prototype card specifically for this unit, with all possible IOs broken out to header pins. I found that this style of prototyping suits my development cycle quite well, as I really dislike using breadboards and wires.

As I try to reuse a certain PCB or design it to be as general purpose as possible, having access to ready-made modules that can be slotted into a base and programmed, really saves a lot of time.

Schematic

Manufacturing

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.

PWM Controller with R/E

Last month I spent quite a lot of time on expansion modules for use with the ESP-12E I2C Base Card. While the system worked exceptionally well as a prototyping and firmware testing platform ( as originally intended ), I immediately saw that the physical size of everything ( base board, with the cards) would be a problem inside any enclosure, when used with a real-world project.

At the same time, I have an ongoing need to design and manufacture a device for a friend, that will have very limited space inside the enclosure due to other essential components.

I have thus decided to combine the functionality of two of the IO Expander cards into a more compact design, on a single PCB ( Which I plan to use to power and control an Air Assist blower on my desktop CNC/Laser cutter, as well as function as a next step prototype for my other project.

The PCB

Let us take a quick look at the PCB.

Starting from the top left, we have the Blower/Fan Header.
This supplies 12v DC to the Blower/Fan motor, as well as the PWM signal to control the speed. ( Level converted up from 5v DC to 12V, and then reduced to 3.3v ) This may seem strange.

Let me explain for some more clarity…
The PWM input on the Blower/Fan is internally pulled HIGH to 12v ( by the motor driver circuitry – I can not change that, as it is a commercial unit.) The datasheet however calls for a 0v to 3.3v PWM signal to control the speed.

There is also a further input from the fan, which is a pulsed speed indicator (Fan RPM). This signal is 5v.

Next to that header, is a UART Header, with Rx, Tx and DTR signals, with a ground. I do no longer add USB-to-UART chips to my designs because they are not used a lot, take up unnecessary space, and I tend to program with ICSP anyway.

On the right of that, (Red/Blue/Yellow Header) are 5v, Gnd and 6 Analog inputs(A0-A3, A6,A7) [A4 and A5 being used for I2C]

The ICSP programming header is below that,
with a jumper to select PCF8574 interrupt on Pin D2 or not

This is followed by 6 GPIO (P2-P7) from the IO Expander, and
additional GPIO (D10, D11, D12, D13) , as well as (D7,D8,D9) [To be used with a Rotary Encoder]

Another 6way Ground header, as well as the 12v input (red), follows.

Finally, we have J1 and J2, which will switch 12v through BSS138 Mosfets to control static speed 12v cooling Fans (Only one of these is PWM capable)


The 2 Relays are optically isolated from the controller and mains isolation cutouts are provided to further keep DC and AC voltages well away from each other. [ they really don’t play well together, don’t they ?]

This wraps up the quick PCB description.

Schematic

The Schematic is below, along with a download link ( zip format, with PNG image files)

Some more pictures

I use stencils with almost all of my SMD assembly. It saves a lot of time, makes for even solder paste application, and prevents the mess associated with applying solder paste with a syringe, or even worse a skewer-stick or something similar. They do cost extra though, but I find it well worthwhile in comparison to the mess and time that they save.

Manufacturing

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.

Using a Rotary Encoder

As part of an ongoing project, I recently designed an expander card for my ESP-12E I2C Base. I am referring to this device( Atmega 328P Base PWM Controller Card). At the time of writing that article, I have not released any of the code for the project. This is a very short post, showing one possible way to implement a rotary encoder onto that particular device. (It can also be adapted for other devices, of course)

Arduino Style Code for using a rotary encoder

// Constants and Variables
const int encFWD = 8;
const int encREV = 7;
int aState;
int aLastState;
int encDir;
int encTurned = LOW;
int encLastState;
int encValue = 0;
int lastEncValue;
const int encInc = 10;

unsigned long lastEncDebounce = 0;
unsigned encDebounceDelay = 50;
const int encBtn = 9;
int encButtonState;
int lastEncBtnState = LOW;
int EncBtnValue = LOW;
int encBtnState;

void setup() {
  //Rotary Encoder
  pinMode(encFWD,INPUT_PULLUP);
  pinMode(encREV,INPUT_PULLUP);
  pinMode(encBtn,INPUT_PULLUP);
  // Init the pins in UNPUT Pullup Mode
  encTurned = LOW; // Flag for encoder

  encLastState = digitalRead(encFWD);
  //Serial
  Serial.begin(115200);
  //Status LED on D13
  pinMode(13,OUTPUT);
  digitalWrite(13,LOW);
}

void loop() {
  lastEncValue = encValue;
 //Handle the Encoder Push Button
 encBtnState = digitalRead(encBtn);
 if (encBtnState != lastEncBtnState) {
    lastEncDebounce = millis();
 }
 if ((millis() - lastEncDebounce) > encDebounceDelay) {
    if (encBtnState != encButtonState) {
        encButtonState = encBtnState;
        if (lastEncBtnState == LOW) {
          EncBtnValue = !EncBtnValue; // Toggle the button Value
        }
    }
 }
 lastEncBtnState = encBtnState;
 // Handle the Rotary Encoder Dial
 aState = digitalRead(encFWD);
 if (aState != aLastState) {
    if (digitalRead(encREV) != aState) {
       if (encTurned == LOW) {
          encLastState = encTurned;
          encTurned = HIGH; // Set Flag
// Setting this flag will get rid of double value entries caused by contact
// bounce inside the encoder. I found it easier to implement this way
// as opposed to using software debouncing as with the button

       } else {
          encTurned = LOW; // Set Flag low
// This will ensure that the value is increased only once per "click"
       }
       if ((encValue < 300) && (encDir == 0)){
          if ((encLastState == LOW) && (encTurned == HIGH)){
            encValue = encValue + encInc;
            encDir = 1;
          }
       }
      
    } else {
      if (encTurned == LOW) {
        encLastState = encTurned;
        encTurned = HIGH;  
      } else {
        encTurned = LOW;
      }
      if ((encValue > 0) && (encDir == 0)){
          if ((encLastState == LOW) && (encTurned == HIGH)){
            encValue = encValue - encInc;
            encDir = 2;
          }
      }
    }
    encLastState = encTurned;
}
aLastState = aState;
encDir = 0;
// Print Some Status
if (encValue != lastEncValue) {
  Serial.print("Encoder Value Changed from ");
  Serial.print(lastEncValue);
  Serial.print(" to ");
  Serial.println(encValue);
}
digitalWrite(13,EncBtnValue);



}

I hope that this will be useful to somebody.

I2C IO Card for ESP-12E I2C Base Card

The I2C IO Card for ESP-12E I2C Base Card is another expander card for the ESP-12E I2C Base Card Project. This PCB is an address-selectable I2C module with two relays and six (6) GPIO pins, all driven from a single PCF8574 running at 3v. The relays are optically isolated, and generous mains isolation cutouts were provided to reduce the possibility of mains voltage tracking. A jumper to enable/disable the i2c pullup-resistors is also provided on the PCB.

The relays are powered from a single LDO regulator, accepting 12v DC from the 2x20pin female header on the bottom of the card. 3.3v and ground should also be applied to the card at the 2x20pin header.

It is worth mentioning that this circuit does not contain level converting circuitry and that the i2c bus thus runs at 3.3v to be compatible with ESP chips.

It is possible to use the card with other processors if the appropriate level converters are used on the i2c bus.

The Schematic

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.