ATMEGA4808 with CAN Bus

In This, Part 2 of my CAN Module series( Read Part 1 here), I will look at my recent modification of a previous ATMEGA4808 Development PCB to include CAN bus hardware. The ATMEGA4804 with CAN Bus development board is part of a set of “benchtop development tools” that I designed specifically to design some CAN Bus controlled Gadgets for use in my car…

The PCB is based on a previous project, in which we experimented with alternative chips to replace the ATMEGA328P.

MakerIoT2020 ATMEGA4808 Dev Board
MakerIoT2020 ATMEGA4808 Dev Board

As I was quite happy with the performance of this particular project, I thus decided to use it as the base for the CAN Bus module as well. The Added CAN Hardware adds only a few cm. to the board, keeping it quite compact, although, it will need a complete redesign once I finally get my gadgets finalised 🙂

What is on the PCB ?


The ATMEGA4808 and its supporting components dominate the left side of the PCB, with a USB connector and a CH340N providing the possibility to upload code to the chip using the Optiboot bootloader. I would however caution you, as there seem to be quite a lot of counterfeit CH340N chips floating around, I received two bad batches already, and from reliable suppliers as well… seems there is something fishy going on in the factory?? Answers anyone?

The Right side of the PCB is dedicated to the CAN Hardware, with the MCP2515 and TJA1050 taking centerstage here. While quite old, the MCP2515 is still readily available for the time being and is also quite affordable. Since I had a few left over from previous projects, I decided to once again make use of what I had on hand.

A 120-Ohm termination resistor ( selectable with a jumper), as well as a screw terminal connector, is provided. The board Reset button, as well as a power and user LED ( on D7), is also in that area of the PCB.

All GPIOs on the ATMEGA4808 were broken out onto header pins, to allow for maximum flexibility and access to features and peripherals on the chip.

Schematic and PCB Design

The Schematic, as mentioned before, is based entirely on a previous project of mine, with the CAN Hardware added onto that. ( I remind everyone once again, that this is a “tool” that I designed for myself to help in getting a specific job done. that will mean that it may or may not be very advanced, or suited for other peoples purposes… but , as a general bench module for CAN Bus development based on the ATMEGA4808, it will be perfect – that is what it was designed to do after all )

Schematic, ATMEGA4808 and supporting components
Schematic, ATMEGA4808 and supporting components
Schematic, CAN Bus Hardware, MCP2515 and TJA1050
Schematic, CAN Bus Hardware, MCP2515 and TJA1050

The PCB is a double layer approximately 8.1cm x 3.3cm rectangular module.
6 3.2mm mounting holes are provided.


Manufacturing

I choose PCBWay for my PCB manufacturing. Why? What makes them different from the rest?

PCBWay‘s business goal is to be the most professional PCB manufacturer for prototyping and low-volume production work in the world. With more than a decade in the business, they are committed to meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, they pride themselves to be our (the Makers) best business partners, as well as good friends in every aspect of our PCB manufacturing needs. They strive to make our R&D work easy and hassle-free.

How do they do that?

PCBWay is NOT a broker. That means that they do all manufacturing and assembly themselves, cutting out all the middlemen, and saving us money.

PCBWay’s online quoting system gives a very detailed and accurate picture of all costs upfront, including components and assembly costs. This saves a lot of time and hassle.

PCBWay gives you one-on-one customer support, that answers you in 5 minutes ( from the Website chat ), or by email within a few hours ( from your personal account manager). Issues are really resolved very quickly, not that there are many anyway, but, as we are all human, it is nice to know that when a gremlin rears its head, you have someone to talk to that will do his/her best to resolve your issue as soon as possible.

Find out more here

Assembly

To save myself time, and ensure that the project is assembled to a high quality standard, I once again opted to have a stencil manufactured in addition to the PCB alone. This is however not strictly required with this board, as the components can still be hand soldered, or solder paste can be manually applied using the method of your choice.

High quality Stainless Stencil
High-quality Stainless Stencil

I used my standard hotplate reflow soldering technique on this board, and it turned out very well indeed, with no solder bridges, making any reworking completely unnecessary, which can in no small part be directly attributed to the super accurate stencil that I used for solder paste application…

Assemble PCB
Assembled PCB

Testing

After assembly, I went through my standard testing ritual, while of course remembering that the ATMEGA4808 is a UPDI programmable chip, which means that you can not just use a USB cable on a brand-new chip…

I uploaded the Optiboot bootloader via that UPDI header, using my own UPDI programmer, that was also a previous project, one that I am very happy to have these days 🙂

A standard blink sketch followed, and then it was time to test the CAN hardware. For this I used Gary J Fowler’s MCP Can Libray ( the same one that I used with the ATTiny1616 a few days ago ), as well as the ATTiny1616 CAN Module that I build a few days ago…

As for the firmware, at this stage, as I am only concerned about testing actual CAN functionality, I made use of the CAN Loopback on both units, and then THe CAN Sender on the ATTiny1616 and the CAN Receiver on the 4808… These sketches are all available in the library examples… so find them there.

Pinouts for the connections to the MCP2515 from the ATMEGA4808 is as follows:

CS is on Pin D7, MISO on D5, MOSI on D4, SCK on D6 and the Interrupt on D10

The ATTiny1616, which I did not mention in part one, is as follows:
CS on D13,MISO on D15, MOSI on D14, SCK on D16 and the Interrupt on D12

Conclusion

Testing went well, with everything working as expected, with the exception of another batch of CH340N chips being suspect… This does however not really bother me, as I am quite comfortable with using UPDI to upload code, as well as using an external USB-to-serial adapter, connected directly to the UART on the ATMEGA4808.

Cosmetically, I made a labelling error on the silkscreen of the CAN Bus connector, swapping Can H and CAN L… once again, this is not a problem to me.

My thanks to PCBWay for another extremely well-made PCB.

CAN Bus support with the ATTiny1616

ATTiny1616 QFN with Can bus support on a breadboard

A short while ago, I started looking at alternatives to the ATMEGA328P ( the chip used in the standard Arduino Uno). That experiment turned out quite well,
with two of the three chips turning out to be useful, the ATTiny1616 and the Atmega 4808 – The ATTiny 202, while working great, has quite a few severe limitations, due to the size of its memory, as well as library support, limiting its actual useful use quite a bit for my purposes.

In this post, which is part of a two-part series, I will look at adding dedicated CAN Bus support to the 1616 and 8408. I am planning to add some gadgets to my car, and would like to have it controlled by a CAN bus interface, and just maybe, interfacing with the CAN bus on the car as well – at least in the future…

This experiment will thus consist of two prototypes with onboard CAN hardware, to be initially used on the bench while building and testing my gadgets – more on them later, if and when they work out the way that I imagine.

What is on the PCB

The ATTiny1616 microcontroller, in a QFN package, has been married to a MCP2515 and a TJA1050. These chips, while old, are still easy to get hold of,
and I have quite a few of them lying around from previous projects. It did thus seem to be a good starting point. The fact that their libraries also works perfectly with the ATTiny1616 and Atmega4808 also went a long way towards selecting them for the project.

The PCB is similar to the ATTiny1616 QFN breakout that I have designed before but with the addition of the CAN-related components.

ATTiny1616 QFN development board with CAN bus, after reflow soldering

Schematic and PCB Design

The schematic is a variation on the earlier breakout PBC, with the addition of the CAN-related components.

ATTiny1616 Schematic - MCU only,
Can bus related components - for use thie the ATTiny1616 MCU


The PCB design has also not changed a lot, I have just added the CAN components to the right hand side of the PCB, and adjusted the routing.

PCB layout design for the ATMEGA1616 with CAN bus Development PCB


3D render of the PCB, with the header pins in non-breadboard configuration – with the CAN bus connector not fitted.

Manufacturing

I choose PCBWay for my PCB manufacturing. Why? What makes them different from the rest?

PCBWay‘s business goal is to be the most professional PCB manufacturer for prototyping and low-volume production work in the world. With more than a decade in the business, they are committed to meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, they pride themselves to be our (the Makers) best business partners, as well as good friends in every aspect of our PCB manufacturing needs. They strive to make our R&D work easy and hassle-free.

How do they do that?

PCBWay is NOT a broker. That means that they do all manufacturing and assembly themselves, cutting out all the middlemen, and saving us money.

PCBWay’s online quoting system gives a very detailed and accurate picture of all costs upfront, including components and assembly costs. This saves a lot of time and hassle.

PCBWay gives you one-on-one customer support, that answers you in 5 minutes ( from the Website chat ), or by email within a few hours ( from your personal account manager). Issues are really resolved very quickly, not that there are many anyway, but, as we are all human, it is nice to know that when a gremlin rears its head, you have someone to talk to that will do his/her best to resolve your issue as soon as possible.

Find out more here

Assembly

I usually can not wait to receive my creations back from the factory – I mean, how can somebody not get excited about receiving their own PCBs back from the factory, especially if you know they will be of the high quality that I have come to trust with all of my PCBWay orders?

This is especially true of the smaller PCBs, as well as those with smaller-sized QFN components, with this board definitely not being an exception.

ATTiny1616 QFN Dev board with Can Bus, in packaging - straight from the factory
PCBs in factory packaging
PCBs in protective wrapping, after opening
PCBs in protective wrapping, just after opening the package
Closeup view of the top side of the PCB
Closeup view of the top side of the PCB

This PCB once again requires the use of a stencil, to accurately apply just the right amount of solder paste to the pads, especially the small QFN package pads of the ATTiny 1616…

High quality stainless steel, laser cut stencil. High accuracy. Definitely worth the investment
High-quality stainless steel, laser cut stencil.

Stencils, at least from my point of view, can be a controversial subject, with some hobbyists arguing that they are not worth the additional expense… I do however believe that they actually save you a lot, in time that you don’t waste on reworking a PCB due to solder bridges, in the correct amount of solder paste that is applied, in the correct thickness, and also time not wasted on the cleanup of the mess that can result from manually applying solder paste.

After solder paste application, all the components are placed in their correct positions, ready to be reflow soldered.
PCB ready for reflow soldering, after manually placing the components in their respective places

The PCB is now reflow soldered with a hot plate, and allowed to slowly cool down afterwards, to reduce thermal shock damage to the joints, that may result from a too-quick cooldown cycle. While I do not own a dedicated reflow oven, the hotplate that I use, seems to match the reflow profile ramp-up of my solder paste, and most of the components perfectly. After achieving a complete solder melt, at about 223 degrees C, I usually switch of the hot plate, and carefully move the PCB towards the edge of the unit, that area is usually a bit cooler than the centre. leaving it there for about 5 to 8 minutes, allow the solder to slowly solidify, after which I remove it and place it on a silicone mat to cool completely.

Through-hole component soldering, and testing

The next step is soldering all the through-hole components, usually header pins and connectors into their respective places. The board is then placed onto a solderless breadboard, and various test sketches are uploaded via a homemade UPDI programmer.

These include the infamous blink sketch, to make sure the chip is alive and survived the reflow soldering. That is followed by a CAN loopback test, and then the actual CAN firmware… I make use of the excellent MCP Can library from Garry J Fowler, as well as the megaTinyCore Arduino core, from Spence Konde.

My thanks to both of these gentlemen, for their excellent and easy-to-use software. A special shoutout to Garry J Fowler, since his MCP Can library correctly releases the CE pin of the device when not in use, thus not locking up the spi bus. [ This is something that many other libraries do not bother to care about ] …

Conclusion

This was once again a fun project to design and assemble. The real testing and development can now start at full speed, as this is just meant to be a tool, with a further revision later down the line. It does of course help a whole lot that I can completely trust my PCB manufacturer, PCBWay, to deliver my PCBs to me EXACTLY as I designed them, and at extremely high quality and precision! Thank you for that!

Stereo I2S Shield – The next iteration…

Last month I started working on a Stereo I2S Audio shield for my ESP32-S development board. Those of you that saw that post will remember that I made some mistakes on the initial prototype, and had to repair it with a few “greenwire” connections.


The prototype shield also required the use of commercial I2S modules to be plugged into it, making for quite a cumbersome first iteration.

Stereo I2S shield stacked onto esp32-S dev board

I decided to do something about that, as the long-term use of this particular shield, as internet radio, with a further “dream” of using it as a remote media player for use from Home Assistant, is moving along well, with progress on the firmware being made slowly but surely.


I decided that, since the Audio Chips seem to be quite easily available, and are modestly priced, getting rid of the plug-in modules, and placing the chips directly on the shield seemed like the next logical step. I also broke out the gain pins of each chip and made provision for easily changing said gain with a jumper, individually for the left and right channels of the I2S Audio shield.

I decided to keep the logic level conversion circuit, as it worked well, as well as provided another layer of protection to the ESP32-S that drives the whole shield. ( These have recently been discontinued by AI-Thinker, but the Espressif version is still begin manufactured and supported).

The power supply section of the board remains the same as the previous version, with a dedicated 5v regulator feeding the Audio section, and a 3v regulator the logic level converters. (I may change this in future, as the ESP32-S board can easily supply the 3v required without overloading the regulator on the CPU board.

Current issues that are carried over from the initial prototype still remain though. The two I2S Audion chips seem to be QUITE power-hungry, pulling almost 2A of current from a 12v supply, with a modest volume of 10 out of a possible 100. This has been reduced down from an earlier 4A to 6A when using a different pair of 4ohm 3W speakers.

This is also one of the reasons for the separate voltage regulators on the shield.

Manufacturing

I choose PCBWay for my PCB manufacturing. Why? What makes them different from the rest?

PCBWay‘s business goal is to be the most professional PCB manufacturer for prototyping and low-volume production work in the world. With more than a decade in the business, they are committed to meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, they pride themselves to be our (the Makers) best business partners, as well as good friends in every aspect of our PCB manufacturing needs. They strive to make our R&D work easy and hassle-free.

How do they do that?

PCBWay is NOT a broker. That means that they do all manufacturing and assembly themselves, cutting out all the middlemen, and saving us money.

PCBWay’s online quoting system gives a very detailed and accurate picture of all costs upfront, including components and assembly costs. This saves a lot of time and hassle.

PCBWay gives you one-on-one customer support, that answers you in 5 minutes ( from the Website chat ), or by email within a few hours ( from your personal account manager). Issues are really resolved very quickly, not that there are many anyway, but, as we are all human, it is nice to know that when a gremlin rears its head, you have someone to talk to that will do his/her best to resolve your issue as soon as possible.

Find out more here

Assembly

This project once again called for a stencil, as the QFN packages of the Audio chips are super tiny, with super tiny tracks and pads. A high-quality stencil definitely goes a long way in ensuring that just the right amount of solder paste is added to each pad. This also reduces the requirements for reworking a board with hot air to fix any solder bridges that might have formed.


The quality of a stencil says a lot about your PCB manufacturer, and in my case, I am extremely happy to say that PCBWay definitely delivers quality. Having used their services for close to 3 years now, I have not received a single faulty PCB or stencil at all. Yes, some PCB’s has had errors, but those were all MY errors. Design errors, not manufacturing errors.

Let us return to the assembly of this PCB, shall we…

As usual, the PCBs arrived very well packaged, and after a quick inspection and some random tests with a multimeter, It was time for solder paste and placing components, while listening to a piece of relaxing music… my way of relaxing…


After about 20 minutes of intense concentration, we have a PCB with all of the components correctly placed onto their respective pads, ready for reflow soldering.


I did things differently this time, by placing the QFN Audio chips in their positions at the same time as all the others. ( I usually drop them in place when the solder is in a liquid state, but with these, I was confident in the stencil, and as these chips were quite a bit more expensive than my usual projects [ over 3 USD each ], I wanted them to slowly get up to temperature, and spend as little time as possible at temperature as well. )


Reflowing was a success, and after inspection, no solder bridges were found. A detailed diagnostic with a multimeter with fine-tipped needle probes confirmed that there were no short circuits or bridges, and I could thus continue with the rest of the assembly – the various through-hole components, being mostly header pins, switches and a DC barrel jack socket.

The speaker wires were soldered directly to the PCB, due to the fact that being a prototype, I did not see the need to raise the cost even more by adding connectors onto a board that may not be used very long if it turns out that there is a problem somewhere.

Testing

The next stage was testing, using the software provided in the initial Stereo I2S Shield post. All went well, but, as mentioned above, I encountered the same high current draw issue, which resolved itself ( in a manner of speaking ) after I reduced the initial startup volume of the unit, and limited the maximum volume in the software.

I can now continue with firmware development, and sort out things like the rotary encoders for the volume and station selection, as well as look at adding an i2c display, and possibly a sd-card for stored music files.

Conclusion

The project is getting along quite well, and this iteration of the prototype did not have any design faults or errors. I am extremely impressed with the reliability of my PCB manufacturer, as their consistent quality products allow me to focus on design, and trust that whatever comes back from the factory will be exactly as I designed it.

While there are still quite a few issues to sort out on this project, I am confident that in the end, it will all turn out the way that I want it to.

My Own DC-DC Buck Converter

Dc-to-DC Back converters have a lot of advantages over traditional linear voltage regulator solutions. Most of these advantages are related to the smaller size of these circuits, in comparison to their linear counterparts, as well as their higher efficiency and lower power consumption to name a few.

I am by no means a power supply guy, and as such, I usually buy my power supply modules. The same also applies to boost and buck converters. I am usually quite comfortable leaving the design of these critical parts to those who actually know what they are doing.

It thus seemed like a reasonable challenge to actually try and design and build one by myself, and that will be the story behind this post.

Finding a suitable driver IC

This journey started at a very strange place. When I decided to go ahead and build this Buck converter module, I had no specific driver IC in mind. I was thus browsing through the long list of dc-to-dc- buck converters on my component suppliers’ website, randomly pulling up a datasheet to take a closer look, mainly looking for something with as few external components as possible, while also having a decent current supply capability, as well as being able to operate on an input supply of 4v to about 24v, which is well within my usual range…

I eventually settled on the MPS MP9943. Definitely not the cheapest but still affordable, and in a QFN8 package, so that I am still able to actually solder it to a PCB!

-Wide 4V to 36V Continuous Operating Input
Range
-85mΩ/55mΩ Low RDS(ON) Internal Power
MOSFETs
-High-Efficiency Synchronous Mode Operation
-410kHz Switching Frequency
-Synchronizes from 200kHz to 2.2MHz
-External Clock
-High Duty Cycle for Automotive Cold-crank
-Internal Power-Save Mode
-Internal Soft-Start
-Power Good Indicator
-Over Current Protection and Hiccup
-Thermal Shutdown
-Output Adjustable from 0.8V
-Available in an QFN-8 (3mmx3mm)
package

and with a peak current supply of up to 3A – Not too bad at all.

The actual design

As mentioned already, I am not ( or at least I don’t see myself) a power supply design expert. I believe I am perfectly capable with the linear stuff, by switchmode was never my strong point 🙂 This prototype will just be based on the recommended design in the datasheet, at least for the first version, and then, later versions may feature some customisation as actually needed.

From the picture above, we can see that there are indeed not a lot of external components required. And in my humble opinion, the efficiency vs load also seems to be quite reasonable.

I thus went ahead and started reading this datasheet in detail. I found two typical-use circuits with recommended component values, from which I build my prototype.

I chose to combine these two circuits to give me a variable output module, that will be selectable between 5v and 3v.

I also chose an inductor with a 6A maximum current rating, as the datasheet states that we should choose one with at least a 25% higher current rating than our peak requirement. My logic here was that 100% would be a good number, as the inductor would in theory never saturate?? as well as produce less heat etc ?? Please comment on this, as I may be barking up the wrong tree here 🙂


The schematic above is what I came up with. A jumper will allow the selection of the output voltage, as this is determined by the value of the resistor at R8, in my case 13K or 7.68k… I also assume that that resistor can later be replaced by a 20k trimpot or similar to give a truly variable output.

PCB Layout

The PCB layout was an attempt to follow the datasheet recommendations as closely as possible, while still having my own design. I am also aware that I may have wasted quite a bit of space, but for now, my focus is on getting a working design. I can always try to squeeze it into a smaller space later.

Manufacturing

I choose PCBWay for my PCB manufacturing. Why? What makes them different from the rest?

PCBWay‘s business goal is to be the most professional PCB manufacturer for prototyping and low-volume production work in the world. With more than a decade in the business, they are committed to meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, they pride themselves to be our (the Makers) best business partners, as well as good friends in every aspect of our PCB manufacturing needs. They strive to make our R&D work easy and hassle-free.

How do they do that?

PCBWay is NOT a broker. That means that they do all manufacturing and assembly themselves, cutting out all the middlemen, and saving us money.

PCBWay’s online quoting system gives a very detailed and accurate picture of all costs upfront, including components and assembly costs. This saves a lot of time and hassle.

PCBWay gives you one-on-one customer support, that answers you in 5 minutes ( from the Website chat ), or by email within a few hours ( from your personal account manager). Issues are really resolved very quickly, not that there are many anyway, but, as we are all human, it is nice to know that when a gremlin rears its head, you have someone to talk to that will do his/her best to resolve your issue as soon as possible.

Find out more here

Assembly

After receiving the PCBs back from the factory, and receiving the components from the supplier, I started on the assembly. While uneventful, It was worth mentioning that this project does require a stencil. The DFN-8 package is quite small (only 3mmx3mm), with eight leads, so that makes for some tiny spacing between them. As it is also a leadless package, I did not want to chance to have too much solder paste in there.

As we can clearly see in the picture above, the pads are super tiny. The other components are 0805 ( for reference).

My standard way for assembling DFN packages is to actually level the part of the PCB while reflowing the PCB with a hotplate. Then, when the solder has all melted and is in a liquid state, I carefully place the part with tweezers and remove the PCB from the hotplate.

Alternatively, I remove the PCB from the hotplate first, leaving it to cool down a bit, and then, using a hot air gun with a small nozzle, reflowing only the area where the part needs to be placed, and carefully placing it onto the melted solder.

Both of these methods seem to be working quite well, for me at least, but the hot air method does however have the risk of a bit of solder splatter, which may form unwanted bridges… The part also gets heated a bit, as it has to be held in place for a few seconds to prevent it from being blown around by the hot air.

Testing


I am quite happy to report that the module works as expected, with a steady output of 3.31v and 5.08v respectively at no load.

Under load, I tested with a 1A and 2A load respectively, both voltages are also stable. Ripple, as measured by myself, and using a “not too good” digital oscilloscope, seems to be about 110mv peak-to-peak.

Using better probes, and a better scope, I may be able to get a better and more accurate reading.

Conclusion

This was quite an exciting project, with setting myself a challenge, and actually achieving what I set out to do. While I am sure that the module in its current state may actually not quite be perfect, and that it surely has a lot of room for improvement, I am satisfied with its performance, and just plainly, the fact that it actually works!

Breadboard Power Rail Bridge

This is a sort of tongue-in-the-cheek project, that started with good intentions, and ended up wholly over-engineered and sort of “broken” due to adding “added features” like LEDs and an additional power header.

What was the initial intention?

[This is what I actually wanted to achieve]


My breadboards all have interrupted power rails, and it is thus always necessary to bridge them with jumper wires to have a continuous rail. This is needed because I very often have more than one project on a single breadboard, and do not want to have to use separate power modules for each. I also tend to test out some part of a circuit on a separate part of the breadboard, before incorporating it into the main circuit.

[ I completely overdesigned this, ending up with something completely different from what I wanted]


Wire jumpers are definitely the easier and fastest, but having been struck by a “what if I do this instead” moment, this tiny PCB was designed and subsequently sent to manufacturing…

So does it work?

Yes, it works, for its intended purpose of bridging the power rails, but that is where the wheels come off. Let me explain, trust me, it will be fun, and we can all laugh at it in the end…

Breadboard power rails are usually marked Red for positive, and Blue or Black for negative… Most people on this planet are also right-handed, and would thus place a power module on the right-hand side of a breadboard ( although some won’t..) Being left-handed myself, and still trying to please right-handed people, my power module will be “upside down” on the left-hand side of a breadboard… which is fine with me, as I remember to swap the colours of the rails in my mind, making red negative and blue positive… not a big issue is you always do it that way…

So what went wrong…

While designing this, I initially planned on a simple PCB bridge, with a jumper on the positive line, acting as a switch, and a continuous ground that is always connected.. all fine, problem number 1 being that I looked at the colours of the power rails while designing it, measuring the gaps etc to get the spacing just right…

Problem number 2 is that the top and bottom rails are in the same configuration, Red at the top, blue at the bottom… and thus plugging in a bridge into either should be ok… and it really should have been, if I did not decide to add a status LED on each side of the bridge, and an additional power header… because turns out that I forgot that the bridge at the top will in effect be “mirrored” when plugged in ( and thus having components that are reversed polarity) – mirrored, due to the fact that you now have to plug the top rail bridge upside down into the breadboard, because it will otherwise interfere with the prototyping space

[This was the direct effect of my lack of attention to detail – and yes, it works perfectly in this configuration – if we ignore the wasted space on the top half of the board]

[This is the practical reality – one bridge must be installed ‘upside-down’]

Lesson learned; I can be quite scatterbrained at times, especially when juggling a few projects and customers at the same time ( I am only human anyway ). Thus this project, although it looks nice, and can be useful, needs to go back to the drawing board for a complete redesign, without all those “added features”

The Schematic


The schematic is straightforward, with no surprises. Two LEDs ( polarity sensitive ) and then those headers and jumpers, which also need up being polarity sensitive – in a manner of speaking

Quite different from what I originally wanted to do

Manufacturing

I choose PCBWay for my PCB manufacturing. Why? What makes them different from the rest?

PCBWay‘s business goal is to be the most professional PCB manufacturer for prototyping and low-volume production work in the world. With more than a decade in the business, they are committed to meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, they pride themselves to be our (the Makers) best business partners, as well as good friends in every aspect of our PCB manufacturing needs. They strive to make our R&D work easy and hassle-free.

How do they do that?

PCBWay is NOT a broker. That means that they do all manufacturing and assembly themselves, cutting out all the middlemen, and saving us money.

PCBWay’s online quoting system gives a very detailed and accurate picture of all costs upfront, including components and assembly costs. This saves a lot of time and hassle.

PCBWay gives you one-on-one customer support, that answers you in 5 minutes ( from the Website chat ), or by email within a few hours ( from your personal account manager). Issues are really resolved very quickly, not that there are many anyway, but, as we are all human, it is nice to know that when a gremlin rears its head, you have someone to talk to that will do his/her best to resolve your issue as soon as possible.

Find out more here

Conclusion

This project served many purposes beyond the actual use of the PCB that was designed. In a way, I am quite happy that I screwed up so badly on this one – here is the reason why:

Because I do quite a lot of PCB design each month, for customers or personal projects, I often tend to get a bit over-confident, and also rush things through,
while believing that I will catch every mistake before I send something off to production. Normally, I am quite good at that, and my error rate is actually quite low… But, This month, being quite busier than usual, and having had a fair amount of distractions, served as the perfect lesson to drag me down a notch or two, and remind me that I have to be way more attentive, especially when things are going hectic, and there are a few projects to juggle around at the same time.

The second reason why it is a good thing when the wheels come off like this, once in a while, is that it serves as a perfect example of what your PCB manufacturer’s actual job is. So, this is especially for the new guys that may not know this: Your PCB Manufacturer has only one job – To manufacture your PCB EXACTLY AS YOU DESIGNED IT – Scary, right? Sure, they will let you know if your design falls outside of their tolerances of capabilities. They will let you know if your board fails a flying probe test if you have that kind of arrangement with them… But it is NEVER their job to correct or attempt to change any of your design files.

So, what is the moral of the story, regarding both of the points that I made above?

If you screw up on the design, it is your, and only your fault. Nobody else is to blame, ever. The buck stops with you, the designer.

Stereo I2S Shield for ESP32-S Dev Board

Sound or music adds another level of complexity to any project. Having the ability to easily add it as a shield, allows for a reduced level of this complexity, and hopefully stimulates some inspiration along the way.

This was the thought process that inspired this Stereo I2S Shield, for use with my ESP32-S Dev Board. During the design process, and actually, before, many things happened that turned this project into a slightly more complicated task than I have initially accounted for.

The short and sweet is that I made a few silly mistakes on the PCB, which, for the prototype at least, has been fixed with a few jumper wires. [ I have since updated the Gerber files with the correct design, omitting these silly mistakes.]

Let us take a look at what happened.

  1. I forgot the ground connection on the 5v Regulator, and since I placed extensive ground copper pours on both sides of the PCB, I missed that one completely.
  2. I forgot to connect the 5v supply to the Max98357A breakout headers
  3. I also completely forgot to connect any signal traces to these breakouts
  4. The breakouts were placed on the wrong side of the PCB ( if looking top to bottom on the picture below, they should be towards the top)

How does this happen, and most importantly, why would I even mention my mistakes here, in public?

The most important here is that I am human. Humans make mistakes. Rushing through converting a design that works perfectly on a breadboard onto a PCB should not happen, but it does happen, and that is why the first iterations of a PCB are called prototypes. Dealing with customers, while working on a design, as well as life’s other interruptions very often results in small mistakes, which I usually catch before a board goes for manufacturing. In this case, I did not catch them until after I received the board back from the factory.

The other part of this coin is transparency. There are many many projects on the internet, some good, some excellent, and some outright terrible. Without giving a score to any of my own, my only intention is that whatever I present on this medium MUST be completely honest, my own work, and it must work. Any mistakes MUST be made public, regardless of what the public thinks of it afterwards.

With the ranting done now, let’s take a look at the board, which, after fixing the issues, actually works perfectly…

(I will make use of a rendered image showing the repaired PCB, as it will be the least confusing)


In the rendered image above, we can clearly see what it should have looked like, with the MAX98357A breakouts in their correct places, and all power and signal traces connected correctly.

Part of the reason for the mistakes on the initial prototype PCB was that I felt it necessary to add logic-level conversion to the I2S modules. The reason for that is that in order to get a bit more volume out of them, they are powered at 5v.


With the GPIO pins of the ESP32 being 3.3v, I felt that it is not warranted to take a risk and power the I2S breakouts at 5v, and send them 3.3v signals. That sparked the whole issue, with adding my standard Bss138-based logic converter circuit to the mixture.


The board contains its own Flash and Reset buttons, which are slaved to the stacked ESP32-S dev board at the bottom.
Further to that, the board provides a DC barrel connector, which will power the I2S shield, as well as the ESP32-S dev board via its Vin Pin

Since the MAX98357A breakouts seem to pull quite a bit of current ( about 500mA or more each, depending on the volume), the shield has its own voltage regulators. I have found that during the experimentation on the breadboard, the single 3.3v regulator on the ESP32-S Dev board was a bit inadequate to drive two of these modules and the ESP32 as well.

Software and Code

The code for the device is far from perfect at this stage, consisting mainly of example code that was provided by the i2s library, to which I have started making minor changes, the most significant being moving the entire audio process to an alternate core of the ESP32. This was done because the audio process seem to be blocking, and, as I plan to later add controls and displays to this device, that would result in an issue later.

/*
  Simple Internet Radio Demo
  esp32-i2s-simple-radio.ino
  Simple ESP32 I2S radio
  Uses MAX98357 I2S Amplifier Module
  Uses ESP32-audioI2S Library - https://github.com/schreibfaul1/ESP32-audioI2S

  
*/

// Include required libraries

#include "Arduino.h"
#include "WiFi.h"
#include "Audio.h"
#include "ESPmDNS.h"
#include "time.h"



// Define I2S connections
#define I2S_DOUT  22
#define I2S_BCLK  26
#define I2S_LRC   25



// Create audio object
Audio audio;

// Wifi Credentials
String ssid =    "<your ssid here>";
String password = "<your password here>";

void audioTask(void *pvParameters) {
  while(1) {
    audio.loop();
  }
}


void setup() {

  // Start Serial Monitor
  Serial.begin(115200);
  

  // Setup WiFi in Station mode
  WiFi.disconnect();
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid.c_str(), password.c_str());

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  // WiFi Connected, print IP to serial monitor
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  Serial.println("");

  // Connect MAX98357 I2S Amplifier Module
  audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
  
  // Set thevolume (0-100)
  audio.setVolume(10);

  // Connect to an Internet radio station (select one as desired)
  //audio.connecttohost("http://vis.media-ice.musicradio.com/CapitalMP3");
  //audio.connecttohost("mediaserv30.live-nect MAX98357 I2S Amplifier Module
  //audio.connecttohost("www.surfmusic.de/m3u/100-5-das-hitradio,4529.m3u");
  //audio.connecttohost("stream.1a-webradio.de/deutsch/mp3-128/vtuner-1a");
  //audio.connecttohost("www.antenne.de/webradio/antenne.m3u");
  //audio.connecttohost("0n-80s.radionetz.de:8000/0n-70s.mp3");
  //audio.connecttohost("http://live.webhosting4u.gr:1150/stream");
  audio.connecttohost("0n-80s.radionetz.de:8000/");
  disableCore0WDT();
  xTaskCreatePinnedToCore(audioTask,"audiotask",10000,NULL,15,NULL,0);
}


void loop()

{
  // Run audio player
  //audio.loop();
 
}


//

// Audio status functions

void audio_info(const char *info) {
  Serial.print("info        "); Serial.println(info);
}
void audio_id3data(const char *info) { //id3 metadata
  Serial.print("id3data     "); Serial.println(info);
}
void audio_eof_mp3(const char *info) { //end of file
  Serial.print("eof_mp3     "); Serial.println(info);
}
void audio_showstation(const char *info) {
  Serial.print("station     "); Serial.println(info);
}
void audio_showstreaminfo(const char *info) {
  Serial.print("streaminfo  "); Serial.println(info);
}
void audio_showstreamtitle(const char *info) {
  Serial.print("streamtitle "); Serial.println(info);
}
void audio_bitrate(const char *info) {
  Serial.print("bitrate     "); Serial.println(info);
}
void audio_commercial(const char *info) { //duration in sec
  Serial.print("commercial  "); Serial.println(info);
}
void audio_icyurl(const char *info) { //homepage
  Serial.print("icyurl      "); Serial.println(info);
}
void audio_lasthost(const char *info) { //stream URL played
  Serial.print("lasthost    "); Serial.println(info);
}
void audio_eof_speech(const char *info) {
  Serial.print("eof_speech  "); Serial.println(info);
}

Important parts of the code to note are as follows

disableCore0WDT();
  xTaskCreatePinnedToCore(audioTask,"audiotask",10000,NULL,15,NULL,0);

This code disables the Watchdog Timer on Core0 of the ESP32, as well as creates the audio task, which is defined earlier in the code

void audioTask(void *pvParameters) {
  while(1) {
    audio.loop();
  }
}

It is also important to note that the loop() in the code is essentially empty, with all code commented out. As mentioned above, I do plan to add additional functionality later, and in that case, there will either be other tasks running, or be some code in the main loop.

Another VERY important issue is the DOUT pin, which I have defined as GPIO22.
This pin is usually used as an I2C pin, but it seems that the I2S hardware on the ESP32-S does not like running the DOUT signal on another pin. This is not an issue, as you can assign another pin to I2C without any issue if you need to use that as well.

Manufacturing

I choose PCBWay for my PCB manufacturing. Why? What makes them different from the rest?

PCBWay‘s business goal is to be the most professional PCB manufacturer for prototyping and low-volume production work in the world. With more than a decade in the business, they are committed to meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, they pride themselves to be our (the Makers) best business partners, as well as good friends in every aspect of our PCB manufacturing needs. They strive to make our R&D work easy and hassle-free.

How do they do that?

PCBWay is NOT a broker. That means that they do all manufacturing and assembly themselves, cutting out all the middlemen, and saving us money.

PCBWay’s online quoting system gives a very detailed and accurate picture of all costs upfront, including components and assembly costs. This saves a lot of time and hassle.

PCBWay gives you one-on-one customer support, that answers you in 5 minutes ( from the Website chat ), or by email within a few hours ( from your personal account manager). Issues are really resolved very quickly, not that there are many anyway, but, as we are all human, it is nice to know that when a gremlin rears its head, you have someone to talk to that will do his/her best to resolve your issue as soon as possible.

Find out more here

Assembly

Assembly was straightforward, with no issues, as all of the components can quite easily be soldered using a standard soldering iron, or hot air. This PCB does not require a stencil, but, you can of course have one made if you want to.

As mentioned in the introduction, I had to do a lot of after-assembly-hacking to get the board to work correctly. This will however not be needed with the second-generation PCB, as I have already fixed all those issues on the Gerber files.

Picture Gallery

Low BOM cost 4-cell 18650 Charger

Due to their high capacity and relatively low cost, LiPo cells are almost everywhere these days. This Low BOM cost 4-cell 18650 Charger module is my attempt to solve another issue.

The 18650 Lipo cell is quite common in my lab, and for an excellent reason, as mentioned above, they are cost-effective and also store quite a bit of energy. recharging them after use has however been quite a lengthy exercise in the past.

The usual process involved a few Lipo Charging modules, all connected via USB cables, charging one cell at a time. This not only takes up quite a bit of time and space but also occupies USB ports that could be used for other purposes.

Based on the ultra-cheap TP4056 chip, these single-cell charging modules cost peanuts, but with the required wiring and battery holders, as well as the cables to supply power, it does not really look very neat. I have thus been looking for a better solution for quite a while now, and had quite a few requirements for my “ideal” module.

The MCP73832 from MICROCHIP seemed like a good choice for a custom design, as it requires only 5 additional external components, which are only two resistors, two capacitors and an led. The chip is also extremely low-cost.

  • High accuracy preset output voltage regulation (+/-0.75%)
  • Output voltage options include 4.2V, 4.35V, 4.4V and 4.5V
  • User-programmable charge current
  • Open-drain status output
  • On-chip thermal regulation
  • Preconditioning and end-of-charge ratio options
  • Under-voltage lockout

Includes integrated pass transistor, integrated current sensing, and reverse discharge protection in 5-pin SOT-23 and thermally-efficient 8-pin 2mm x 3mm DFN packages.

The Prototype Module


The design that I came up with, can charge 4-cell simultaneously. The maximum input voltage is limited to 6v DC.


Another interesting feature is the ability to use either through-hole battery holders or SMD ones. I did that because I have quite a few of the through-hole ones in stock, but as they were bought quite a while ago, the exact part number went on holiday. When having the module assembled in the factory,the SMD parts can be used, as there seems to be plenty in stock.

The Schematic

Because I enjoy a challenge, the design uses the smaller 3mm 2mm DFN8 package. Charging current is set with R9, which is 2k in this case, which will result in a charging current of the full 500mA. You can adjust it as per your requirements, to a value between 2k and 10k, as per the datasheet.

The full schematic is available here:

PCB Design

The PCB design was optimised to fit on a 10cm x 10cm board. Most of the board is made up of a solid copper pour to provide a good ground plane. Charging circuitry is placed as close together as possible, with a good connection of the thermal pad on the DFN8 package to the ground plane to help with thermal regulation. In this case, I have attempted to replicate the suggested reference design as closely as possible, while adapting it for use with the DFN8 package (Reference design uses the 5 lead SOT-23 package)


As seen in the close-up, components are placed as close as possible to the MCP73832, and via stitching are used to ensure a good connection to the ground, as well as allow the ground plane to serve as a heatsink.

Manufacturing

I choose PCBWay for my PCB manufacturing. Why? What makes them different from the rest?

PCBWay‘s business goal is to be the most professional PCB manufacturer for prototyping and low-volume production work in the world. With more than a decade in the business, they are committed to meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, they pride themselves to be our (the Makers) best business partners, as well as good friends in every aspect of our PCB manufacturing needs. They strive to make our R&D work easy and hassle-free.

How do they do that?

PCBWay is NOT a broker. That means that they do all manufacturing and assembly themselves, cutting out all the middlemen, and saving us money.

PCBWay’s online quoting system gives a very detailed and accurate picture of all costs upfront, including components and assembly costs. This saves a lot of time and hassle.

PCBWay gives you one-on-one customer support, that answers you in 5 minutes ( from the Website chat ), or by email within a few hours ( from your personal account manager). Issues are really resolved very quickly, not that there are many anyway, but, as we are all human, it is nice to know that when a gremlin rears its head, you have someone to talk to that will do his/her best to resolve your issue as soon as possible.

Find out more here

Assembly

Assembly of this module definitely requires the use of a stencil. The DFN-8 package of the IC is only 3mm x 2mm, and there are 8 leads as well as a thermal pad crammed in there. A stencil will ensure that you add just the correct amount of solder paste to each pad.


As we can clearly see in this cropped picture of the stencil, those pads are SUPER tiny.

I chose to use the hotplate, as well as some hot air for the SMD component assembly. The battery holders and DC barrel-connector are all through-hole, and were thus assembled using a standard soldering iron, with slightly thicker solder, and a bit more heat than normal, as the pads are quite big, and the big copper pour really sucks the heat away from the joints.

Testing

Testing the module went really well. I used four 18650 cells that needed recharging, and they were very quickly ( in about 1 hour ) charged to 4.20 volt.

The Charge Indicator LED on each charging circuit works in reverse from what we would normally expect, with it lighting up while charging, and going out when done.

The current draw (measured on the bench power supply) verified that each cell was charging at the 500mA as designed. The current draw also reduced as each cell charging cycle completed and eventually went down to very close to zero (The Ampere meter on my bench supply can not measure very low current with a lof of accuracy -:) )

Measuring each cell that have completed its charging cycle with a standard multimeter confirmed that they were indeed at 4.20v, and that the charging circuitry was no longer feeding current to any of them.

Drawing current out of a single cell (I used a set of clips ) to power a dummy load, resulted in an automatic recharge cycle being initiated once the cell voltage dropped past the set charging threshold.

It is however VERY important to note that this module is by NO means a balanced cell charger. It is a 4-way single cell charger that charges 4 cells independently from each other, at the same time. It is thus completely possible as well as probable that the four cells will/may be at slightly different voltages at the end of each respective charging cycle.

Conclusion

This project is most definitely high on the list of my most needed items. Keeping a bunch of 18650 cells charged and correctly maintained can be quite a chore, and the way that I have done it in the past was definitively not ideal.
It has also cost me quite a few cells that died way before their time.

Using this module, the chore of charging these cells will be reduced by a lot, and hopefully, in the future, I will come up with a solution to augment this module so that I can have these cells on a semi-permanent charge, with monitoring and only charging those cells that needs it.

Pictures

Variable Breadboard Power Module

A few weeks ago, I designed and built my own breadboard power module, mainly to try and solve some perceived problems with commercial ones, and also just to have something that is completely my own.

While that design does indeed work very well, I did however find a few tiny issues that still needed attention.

  • Two fixed voltages, 3.3v and 5.0v
  • 1A current limit per regulator
  • PCB Heatsink design can be improved further, as there is still a bit too much heat at a high current draw – not much actually, but I like things running as cool as possible.

Other requirements that popped up were the ability to have more than two set voltages, as well as being able to send the full Vsupply to a power rail if I choose to do so…

Having a few LM317G variable voltage regulators lying around, left over from a previous project, I decided to use those. They can source an additional 500mA of current (1500mA in total) and also makes it quite easy to have variable voltages.

Voltage is set with two resistors, of which one is usually a variable resistor. This does however mean that you need a multimeter or other device capable of measuring voltage each time that you need a different voltage, as well as to determine at what voltage the device is currently set if you have not used it in a while…

The initial prototype is quite bulky at the moment, but I do plan to change that in the future when I am completely happy with the performance of the module

Each “voltage channel” consists of a 5k multiturn “trim pot” that connects back through a selectable jumper to a 240-ohm resistor ( I actually used two precision 120-ohm resistors in series) on the adjust pin of the regulator.

I have also reduced the number of smoothing capacitors on the input and outputs, as the voltages are quite stable

After assembly, it only takes a few minutes to adjust each “trim pot” to the correct value using a small screwdriver and a multimeter. Once set and verified, they can be locked using a drop of “lock-tight” or similar.

The eight “trim pots” sets the voltages as follows:

Top Rail:
VR1 – 3.3v
VR2 – 5.0v
VR3 – 7.2v
VR4 – 9.0v

Bottom Rail:
VR5 – 3.3v
VR6 – 5.0v
VR7 – 7.2v
VR8 – 9.0v

Turning the “pot” anti-clockwise reduces the voltage, while a clockwise movement increases it.

Changing voltages then becomes as easy as changing a jumper to a preset position.

The Schematic


As mentioned above, I have used two precision 120-ohm resistors on one leg of the resister divider that is connected to the adjust leg. Feel free to replace that with a single 240-ohm resistor and a 0-ohm bridge.

The multiturn precision 5k trim pots give great control and the desired voltages can be dialled in very accurately.

The module was designed as a double-layer PCB. I used big solid ground planes to provide good grounding, as well as serve as heat sinks for the voltage regulators.


Manufacturing

I choose PCBWay for my PCB manufacturing. Why? What makes them different from the rest?

PCBWay‘s business goal is to be the most professional PCB manufacturer for prototyping and low-volume production work in the world. With more than a decade in the business, they are committed to meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, they pride themselves to be our (the Makers) best business partners, as well as good friends in every aspect of our PCB manufacturing needs. They strive to make our R&D work easy and hassle-free.

How do they do that?

PCBWay is NOT a broker. That means that they do all manufacturing and assembly themselves, cutting out all the middlemen, and saving us money.

PCBWay’s online quoting system gives a very detailed and accurate picture of all costs upfront, including components and assembly costs. This saves a lot of time and hassle.

PCBWay gives you one-on-one customer support, that answers you in 5 minutes ( from the Website chat ), or by email within a few hours ( from your personal account manager). Issues are really resolved very quickly, not that there are many anyway, but, as we are all human, it is nice to know that when a gremlin rears its head, you have someone to talk to that will do his/her best to resolve your issue as soon as possible.

Find out more here

Assembly

The assembly of this module is quite easy, no stencil is required. I recommend that you take care of the SMD components first, using hot -air or even hand soldering them, before assembling the through-hole components.

Here I do recommend that you use a breadboard to make sure that the 2.54mm headers that will connect to the power rails are lined up nicely

Testing and Setup

As already described above, the module does require a bit of setup after assembly. To do this, you will require a DC power supply with a voltage of 7v to 12v, as well as a multimeter, preferably with clips on the test leads, as well as a small terminal screwdriver.

  • With the module powered, and the Rail Voltage jumpers set to VCC, measure the rail outputs with the multimeter ( remember that the rail active jumper MUST be set to on). Both rails should be at the same voltage as your VCC input voltage, ie 12v DC
  • Move the Select Voltage jumper for both rails to the 3.3v position, and the Rail voltage jumper to the VSelect position for both rails.
  • With the multimeter connected to each rail in turn, turn VR1 anti-clockwise until the voltage for the top rail is set to 3.3v. Repeat for the bottom rail, adjusting VR5 instead, while measuring the bottom rail.
  • Repeat this step for each of the voltages, remember to power off the module before changing jumper positions – to prevent accidental short circuits…

Pictures

ATMEGA4808 – An Improvement on my previous design? Or Not…

Atmega4808 Development Card in Acrylic Shell

When I first started playing around with the ATMEGA4808, I was impressed as well as disappointed by the Arduino Every “Clone” that I got online. Impressed with the Microprocessor, but disappointed in the way the development board worked, the lack of documentation etc.

I set out to change that by doing my own version, something that I do quite a lot. If I don’t like something, and it is in my ability to create/design my own version, minus any of the perceived(in my opinion mostly) flaws of the original design, I usually do just that.

With that mindset firmly in place, a few weeks ago, I did indeed redesign an ATMEGA4804-based development module, and it worked flawlessly…

As time went by, that little irritating voice in my head got louder and louder… add this, change that, what if it was like this etc… Many makers will know exactly which little voice I am talking about.

Two Atmega4808 Modules, side-by-side

So what did I change?

The short answer to that is a lot. the long and detailed, well let’s see…

  1. Added an additional LDO voltage regulator, to provide more current.
  2. A DC barrel jack was included, enabling us to power this from 7v to 12vDC
  3. Changeable logic level ( switching entire board between 3.3v and 5v operation )
    with a single jumper.
  4. Improved labelling of GPIO functions (on the back of the PCB), listing alternative functions etc for each GPIO
  5. Put all that into the standard Arduino Uno Footprint…

So, did any of that really matter?

Once again, two answers, one long, one short… so here goes…

The added DC barrel jack, with the two dedicated LDO voltage regulators, adds flexibility to power the device externally, opening up possibilities to use it in a stand-alone project, not only on the bench.

The Logic level switching, which at the time, seemed like a very very good idea, now no longer seems so important…

Using the Arduino Uno footprint, yeah, so what, it is a neat layout, but apart from using a somewhat ” traditional” footprint, is only cosmetic…

That leaves only the updated silkscreen on the back of the PCB, as well as better labelling on the front…

Back Silkscreen
Front silkscreen

As far as information goes, yes, this is a great help. It will definitely save some time reading datasheets and looking up other stuff…

Does this mean the project was a failure?

Definitely not. I am not negative, but instead, have a tongue-in-the-cheek attitude about how sidetracked I became. I mean, this is basically the exact same board, with just a different form factor. So, in that case, think about it in the context of an Arduino UNO and Arduino NANO. Both of them use the exact same processor but only differ in footprint. ( as well as a few other cosmetic things and functions – the nano having additional analog inputs etc.).\

I am sure that the new form factor will appeal to some, and others will feel it was a completely unneeded design.

The Schematic

ATMEGA4808 Schematic

The schematic does not contain any surprises. everything is basically similar to my initial breakout module design, with the exception of the power section. I tried something different, and the jury is still out on how well it actually worked.

When powered from USB, the 3.3v LDO Voltage regulator gets fed directly from the USB Voltage, through a protection diode of course.. Similarly, when powering the device using the DC power jack, both LDO regulators are once again fed separately… for the time being, it seems to work well. Time will tell if it was the correct way to do things.

PCB Design

Top Layer
Bottom Layer

A lot of care was taken to attempt routing of all tracks at the shortest distance possible, as well as using differential pairs for the UART, SPI and I2C peripherals. PCB heatsinks for the LDO regulators, as well as ground planes on both side of the PCB, was also implemented.

Manufacturing

I choose PCBWay for my PCB manufacturing. Why? What makes them different from the rest?

PCBWay‘s business goal is to be the most professional PCB manufacturer for prototyping and low-volume production work in the world. With more than a decade in the business, they are committed to meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, they pride themselves to be our (the Makers) best business partners, as well as good friends in every aspect of our PCB manufacturing needs. They strive to make our R&D work easy and hassle-free.

How do they do that?

PCBWay is NOT a broker. That means that they do all manufacturing and assembly themselves, cutting out all the middlemen, and saving us money.

PCBWay’s online quoting system gives a very detailed and accurate picture of all costs upfront, including components and assembly costs. This saves a lot of time and hassle.

PCBWay gives you one-on-one customer support, that answers you in 5 minutes ( from the Website chat ), or by email within a few hours ( from your personal account manager). Issues are really resolved very quickly, not that there are many anyway, but, as we are all human, it is nice to know that when a gremlin rears its head, you have someone to talk to that will do his/her best to resolve your issue as soon as possible.

Find out more here

Assembly

The assembly of the ATMEGA4808 development card, as I named the creation, can be done entirely with a standard soldering iron and steady hands, but I chose to order a stencil with the PCB and reflow the PCB on a hotplate.

Stencil for SMD assembly

I prefer this way of assembly, as it is generally faster, looks neater, and ultimately uses less solder paste. This particular build did however give me a few headaches, which may be the underlying reason for my tongue-in-the-cheek attitude towards this PCB…

Let us take a look at some of the issues that I encountered

The Micro USB B connector that I used, seems to be quite sensitive to heat. I have a few different batches of these, and some are good, while others are just terrible. ( this happens because I did not buy them all from a reputable supplier, but opted for an online supplier instead – NOT LCSC as I normally do).

This resulted in having to change USB connectors a few times.

The second issue was the CH340N USB to Serial chip. Due to availability issues, I was once again forced to use an online supplier, and ended up receiving only two working chips out of a batch of 20! The fact that they were super cheap, with super fast shipping should have alerted me that something was wrong…

These two issues caused quite a lot of headaches and ultimately cost me an ATMEGA4808 chip, that for reasons unknown, died without any explanation, with the board pulling a crazy 3.5A at 5v for a few seconds. Subsequent testing revealed a failed 5.0v LDO regulator, which after being replaced by a new one, resulted in a perfectly working board. ( after sorting the CH340N and USB connector issue of course)

Conclusion

This build gave me a lot of problems, tested my diagnostic skills, as well as provided proof that you definitely get what you pay for. Electronics component supplies are still not quite at the level of availability that we are used to, with huge lead times and delays being a big issue.
This presents us with the tempting solution of buying a few components from dubious online companies; sometimes you get a good deal and sometimes you get only headaches like I was rudely reminded with this build.

As far as the PCB is concerned, there are absolutely no issues. Everything works as expected, and while no real changes were made between the two versions, It has already earned a permanent place on the bench, having replaced my old Arduino Uno clone as my goto development board when doing something ATMEGA related.

Some More Pictures

A complete ATTiny1616 Dev Solution

A few weeks ago, I started looking into alternative development solutions to reduce the effect of hard-to-get or more expensive-than-usual ATMEGA328 chips. One of the chips that I found to have potential was the ATTiny1616.

There seemed to be quite a lot of stock, and the prices were reasonable. Some additional hardware, like a dedicated UPDI programmer, had to be designed or bought, as the ATTiny1616 required UPDI to upload and flash code.

Setup to program ATTiny1616 Breakout Module – Power Module ( Left – Optional) ATTiny1616 Breakout – Center, UPDI programmer ( Right)

While the breakout worked flawlessly, I found the programming setup awkward and cumbersome. That was the cue to take the next step and create something that was easier to work with.

Old versus new. ATTiny1616 breakout module and programmer (Top) versus the all-new ATTiny1616 Development board, with all required hardware, included.

The new PCB offers a development cycle that is very similar to a standard Arduino UNO or Nano. Plug it into a USB port, write code, upload and repeat…

What is on the PCB?

Top view- In acrylic Case

Starting at the Top Lefthand corner, we have a USB port, with a CH340N Chip. Note that this IS NOT A SERIAL UART. This is an integrated UPDI programmer, that can also be used in stand-alone mode to program external devices. (by moving J3 to the left, and using the UPDI header).

Below that is the power supply section, featuring two LDO Voltage regulators, providing 3.3v and 5v DC to the system. A DC barrel jack is included, to supply between 7v and 12v external DC voltage to the system. ( NOT to be used together with a USB cable)

Jumper J2 (next to the DC barrel jack) is used to switch the entire board logic level between 3.3v and 5v DC. A power indicator LED, as well as a standard user LED ( on pin D16), is also included. The rest of the PCB is dedicated to the ATTiny 1616 -SF, this time in a TSOP form factor. ( The original breakout used a QFN, but I realised that that may push away a lot of potential users, as QFN packages are quite difficult to solder without the proper equipment. A TSOP package is more accessible to everyone)


A total of 17 GPIO ports are available, of which each is labelled with an Arduino compatible label (D0 – D15), PWM ~ capable pins, and alternate functions like UART, SPI and I2C. Please Note that the onboard USB port IS NOT A UART

Features on the PCB – Summary

  • Reset Circuit with Push button – The ATTiny1616 shares its Reset pin with the UPDI programming pin. This will cause problems, requiring an HV UPDI programmer to fix. To resolve this issue, a reset circuit, comprising of a p-channel logic level Mosfet, that is wired to be constantly on, is connected via a suitable resistor on its gate, to a push-button to ground. pressing the button pulls the gate to ground, switching off the Mosfet, and thus the supply voltage to the chip, which equates to a power cycle reset. It is worth noting that the UPDI programming sequence also auto-resets the chip after every upload.
  • DC barrel jack for powering the device from an external source – 7v to 12DC
  • Onboard I2C pull-up resistors, selectable with a jumper ( J1)
  • Onboard UPDI programmer, which can also be used in stand-alone mode.
  • Selectable voltage logic level between 3.3v and 5.0v ( J2)

Manufacturing

I choose PCBWay for my PCB manufacturing. Why? What makes them different from the rest?

PCBWay‘s business goal is to be the most professional PCB manufacturer for prototyping and low-volume production work in the world. With more than a decade in the business, they are committed to meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, they pride themselves to be our (the Makers) best business partners, as well as good friends in every aspect of our PCB manufacturing needs. They strive to make our R&D work easy and hassle-free.

How do they do that?

PCBWay is NOT a broker. That means that they do all manufacturing and assembly themselves, cutting out all the middlemen, and saving us money.

PCBWay’s online quoting system gives a very detailed and accurate picture of all costs upfront, including components and assembly costs. This saves a lot of time and hassle.

PCBWay gives you one-on-one customer support, that answers you in 5 minutes ( from the Website chat ), or by email within a few hours ( from your personal account manager). Issues are really resolved very quickly, not that there are many anyway, but, as we are all human, it is nice to know that when a gremlin rears its head, you have someone to talk to that will do his/her best to resolve your issue as soon as possible.

Find out more here

Assembly

Stencil for Assembly

While this board can definitely be assembled completely by hand soldering, I chose to make use of a stencil, from PCBWay. This helps me by ensuring that the solder paste is applied in exactly the correct amount and place. Hot air or reflow soldering afterwards is a quick easy task. I prefer to use a hot plate to reflow the board, especially since it has a tiny USB connector, which can be quite a pain to solder with hot air, I won’t even go there with a normal soldering iron, as it is beyond what my eyes can handle at this stage.

Some more pictures