NeoPixel CAN-Bus Module with local control

As part of my current project to add NeoPixels to the cabin of my car – as an upgrade to an old run-around vehicle, I had various ideas. One of these was to have pixels in multiple locations in the cabin, for example, next to the rear doors on each side, as well as in the current location of the current, sad old yellow light, in the centre of the cabin. These pixels should be controllable from a central location, on the front dash of the vehicle, or above the rearview mirror, as well as have local control.

CAN-BUS seemed the logical way to have central control over all of these, and as far as local control goes, I don’t necessarily want to go messing with the 20-odd-year-old wiring of the car, it is problematic already, and my interference could just potentially make things worse. ( living in super humid SE Asia takes its toll on the wiring, and local auto-electricians make more than a mess than fix anything – while still maintaining their “standard” of high-quality pricing for an ultra-low quality job – thus scrap that right from the beginning)

I have thus decided on a three-pushbutton approach, White light, on and off, Red light on and off, and increase/decrease intensity ( I really want the red cabin lights, as it helps to preserve night vision as opposed to white)

This project is not thus a less complicated version of this,
which is the main controller PCB, minus a few components, for example:
No Buck converter – just a single LDO regulator
No Supply OR-Ing logic, as there will be only a single supply
No Battery charger, and for that matter Boost converter.

The board still uses the ATTiny1616 microcontroller ( I had a few in stock, and since I don’t need a lot of power for this, they are ideal).

CAN-BUS support is provided with an MCP2515 and supporting circuitry.
All GPIO’s on the ATTiny1616 and MCP2515 are broken out for easy access, so it is possible to really hack this board into anything needed within reason.

The NeoPixels VCC line is also controlled via a P-MOS switch, to keep them totally switched off until actually needed, thus saving a few milliamps of battery power.

Note that no connectors were fitted yet, as I am still testing the firmware of this PCB,

The Schematic

I have decided to include the schematics as downloadable .png files. just click on the images for a high-resolution picture that you can download to your device.

Manufacturing the PCB

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 who will do his/her best to resolve your issue as soon as possible.

Find out more here

Assembly and Testing

Assembly is easy, if you use a stencil. The ATTiny 1616 QFN package will give you a hard time without a precise way to apply just the right amount of solder paste to the pads.

Testing

As far as testing goes, I am busy with the final firmware of this board.
I will however go over a few things:

The UPDI programming header functions as expected, using my own programmer, and the Arduino IDE.

A standard blink sketch works as expected ( LED is on PIN_PA3)
This is also the SPI SCK pin.

The CAN BUS hardware functions as expected ( Using the MCPCan library)

A small NEOPixel strip ( 8 pixels ) connected to the module and controlled with the Adafruit NeoPixel library functions as expected – Note here that you HAVE to enable power to the pixels by pulling PC0 ( PIN_PC0) HIGH to enable the P-MOS Switch. The Pixels themselves are connected to PIN_PA6.

The 3 pushbutton switches function as expected, and are connected on PIN_PC1 to PIN_PC3, each with an external 10k pullup resistor.

I shall update further progress on the project as it becomes available. I am currently working on firmware, as well as designing a suitable enclosure to be CNC cut from acrylic.

Powering the modules in the actual vehicle shall also require some clever thinking, as I do not want them draining the car battery – I am thinking about either using the existing door-open switches or maybe an interface from the ignition to only power them when the ignition is switched on.

NeoPixel strip with built-in LDO

Neopixels are interesting. They can be almost any colour that you require, are usually quite easy to configure, can require a fair bit of current if used in sufficient quantities, and can be quite fragile when soldering—not to even talk about resoldering them onto a different PCB. My biggest pain with these versatile little LED modules is that they seem to only operate on 5v DC.

This may be fine in many environments, but for my current project, using them as replacement lighting modules for the cabin lights of my car, that 5v requirement will mean a lot of additional wiring. So I decided to just use the 12 DC that is already conveniently present in the car, and add an LDO regulator to the strip – yeah, I know, this may be nothing new, and yes, I am aware of the current limitation issues of LDO regulators.

What is on the PCB?

Well, in this case, it is a quite straight-forward answer. 12 NeoPixels, a 5v LDO regulator, and some capacitors. The LDO regulator can provide a constant current output of 800mA and 12 Neopixels with a maximum current draw of 60mA each, will require 720mA, so everything seems to be ok in the current department. I am also never going to run them at maximum current either, as they will be way too bright!

Two 5-way header pins provide the standard Power, ground, data in and data out connections – note that I have still provided a 5v input, just in case I want to reuse these in another application, where 12v is not available…

Schematic

The 12 Neopixels are daisy-chained from pixel 1 to pixel 12, with a 100nf capacitor over the power rails of each pixel.

An AMS1117-5.0 LDO regulator provides voltage regulation down to the required 5v DC. This means that the maximum input voltage can be as high as 15v DC ( remember that most of this will be disposed of as heat by the regulator – I have provided an on-pcb heatsink, but recommend that the input voltage be limited to 12 DC at a maximum – to not over-drive the regulator )

The two 5-way headers provide connections for power, ground and signals. There are from pins 1 to 5:
VIN: 12v DC maximum down to 7.2 v DC
VCC: 5v DC only
DIN: Data In
DOUT: Data out
GND: Ground connection

Using the strip

The NeoPixel strip will work with all common NeoPixel libraries, including Adafruit NeoPixel. One word of caution though – NeoPixels are never truly switched off; even when not lit up, the chip inside the pixel still consumes about 1 mA of current. While this may not seem like a lot, it quickly adds up, and can potentially drain a battery-operated system completely in a few hours if you use a lot of them.

It is thus considered good practice to completely remove the input voltage from the pixel power pins when not in use. I am currently experimenting with a way of doing this via a Mosfet and transistor combination that will be controlled from the same microcontroller that drives the strip. Yes, you end up using another gpio pin, but you also potentially save a lot of power; in my book a good trade-off, since gpio pins on microcontrollers are plentiful these days, and we rarely use all of them anyway…

The circuit comprises a simple NPN transistor ( BJT type) that drives the gate of a P-MOS mosfet, acting as a switch, that, when switched on, provides power to the NeoPixel strip.

Manufacturing the PCB

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 who will do his/her best to resolve your issue as soon as possible.

Find out more here

Assembly and Testing

This PCB’s assembly is straightforward and can be done without a stencil, using a very fine-tipped soldering iron, or, in my case, with a stencil and hotplate to reflow solder the components all at once.

Be careful never to heat a single pin on the NeoPixel chip for longer than about 2-to-3 seconds. The wires inside the chip are super super tiny, and the excessive heat can cause damage to them, leaving you with a pixel that does not work.

The stencil that I used for assembly

Assembly of the ATTiny1616 Can bus controller PCB

The Assembly of the ATTiny1616 Can Bus Controller PCB will be covered in this post. This PCB took quite a bit of time, due to having a real-world job that takes up an extreme amount of my time.

Enough of that, let’s get started

The PCB

The PCB is a double layer, with mostly SMD components, and as mentioned in the initial post, broken up into functional blocks to make testing easier. I will also take the time to mention some performance and problem issues that I have encountered during the testing phase here are well


These include:
– a buck converter power supply module to provide 5v DC.
– a single-cell lipo cell charger circuit
– an ideal diode supply or-ing circuit
– a boost converter
– various jumpers, so enable/disable certain parts of the circuit
– microcontroller and logic circuits

The bare PCB

All of the circuit modules mentioned have been covered in detail in previous posts, so I will only briefly review some of them here to highlight some changes I have made to the original circuits.

The ideal diode supply or-ing circuit has been modified to use 3 ideal diode chips in parallel per “channel”. This is “experimental” from my point of view since I am unsure if it would actually perform as expected. I had to do this due to experiencing great difficulty in obtaining a suitable high-current component at a reasonable cost and in a suitable footprint.

This question remains unanswered, as I encountered a double whammy with no stock issue forcing me to use one device per channel. I shall update the performance of this experiment soon when I receive the back-ordered components.

The performance of the boost converter can at best be described as temperamental. This is definitively an assembly issue on my side, as the controller chip is tiny (approx. 2mm x 2mm with 14 leads), and hand assembly of this with a stencil and hot-plate reflow almost always results in the need to hot-air rework and then possibly damaging the chip with heat or other issues.

I am currently investigating an alternative chip to use in future versions of the PCB to remove this issue. When the circuit works, it is rock solid and gives great performance. Maybe someone from Microchip (#not sponsored) can give some advice here…

The Buck converter performs solidly as usual, great little device! No complaints there as usual.

The Lipo-cell charger performs as expected, with no issues to report.


As seen in the picture above, I have placed yellow jumpers to make it easy to enable/disable parts of the circuit to aid in testing and debugging. These help quite a lot.

The ATTiny 1616 is solid, as can be expected, and functions exactly as expected. Some users would have to replace the R_UPDI resistor with a 0ohm link, depending on which UPDI programmer you use. Since I use my own custom-made UPDI Programmer as recommended in a circuit by Spence Konde/Dr Izzy on his excellent megatinyCore documentation site, I have no issues with UPDI.

The Can-Bus hardware functions as expected, with no issues to report.

There is also an error on the silkscreen, Pin_PC1 should be pulled HIGH to activate the VCC line for the neoPixel strip, NOT LOW as printed on the silkscreen.

Manufacturing the PCB

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 who will do his/her best to resolve your issue as soon as possible.

Find out more here

Assembly and Testing

Due to the size of some of the components on this PCB, a stencil is compulsory for hand assembly of this PCB, or even better, have it professionally assembled by your PCB manufacturer. It will save you a lot of headaches during assembly

The stencil that I got from PCBWAy made things so much easier
The assembled PCB, without CAN connector and Lipo Cell

Conclusion

This project took way longer than initially planned, due to many issues including logistics, component availability, the need to rework some areas of the board, and being super busy at my day-job. The firmware is still a work in progress, with bits and pieces of code floating around, hacked together to test basic functionality but nothing else.

I hope to complete this project very shortly, and after a final revision of the hardware, to get rid of some issues that bug me, to have a very useable piece of equipment to finally install in my car as planned from the very beginning