Monday, 4 July 2022

NeoPixel Circle PCB

The next step in the DMX patio lamp is to create a PCB with the neopixels on it.

The previous posts for reference are:

https://langster1980.blogspot.com/2022/07/designing-dmx-controlled-patio-light.html

https://langster1980.blogspot.com/2022/07/dmx-to-neopixel-arduino-shield.html

I am going for 32 LEDS but I may change my mind. It depends really on the size and spacing achievable as well as current draw and voltage drop.  Lets see what works first.

I'm confident I could design this PCB straight away but it is always a good idea to read through the datasheet and do some calculations...there may be something critical I have missed or didn't know.  I've used neopixel tape several times but I've never really bothered to read up on their technical aspects.

Here is the datasheet: https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf 

The datasheet isn't the worst I've looked at but it isn't the best either...

After some reading...and some more reading here is what I have found:

The package contains 3x LEDS and a control circuit.  According to the research the control circuit draws
8 mA with all the LEDS not active (Off). 

The Red LED draws 13 mA when fully on. 

The blue LED and green LEDS also draws 13 mA when fully on.

Therefore each pixel (3x LEDS in one package) draws 60 mA.  

If we have 32 pixels our current draw with each LED fully on (White colour) will be:

So if the calculations are correct...then we need to account for this 1.6 Amp current draw on our PCB layout. Our connector and wiring also need to handle 1.6 Amps - I'm going to design for 2 Amps to provide a little margin.

Here is the circuit diagram:
NeoPixel Lamp Schematic

Next we need to design a PCB layout.  I'm going for a circular PCB which will fit behind the 84 mm polycarbonate cover.  Lets set the diameter of the PCB to 80 mm - that way I know it will fit with room to spare. I will need a mounting option too...not worked that out yet!  I suspect some stand offs and attached to the cover will work fine.

Here is the PCB layout:

NeoPixel Lamp Top Layer - PCB Render


NeoPixel Lamp Bottom Layer - PCB Render

I added an extra pixel in the centre of the PCB as there was room.  I also added some mounting holes which weren't on the schematic.  The layout went quite well and only took me a couple of hours...must be getting better at this although it isn't because of practice!  I did have a nights sleep between the hours...maybe that helped...

I have exported the gerber files...next job is to get a quote from JLPCB and then assuming the price is right get some boards made.  I'm going to go with black silkscreen.  

I think that's all for now - take care, Langster!

Friday, 1 July 2022

DMX to Neopixel Arduino Shield

In a previous post (nearly a year ago!) I mentioned I was going to design an Arduino shield to allow DMX control to Neopixels.  I actually did design a board but never wrote a blog post about it.  Here is where I rectify that.


I decided to design my own DMX shield for the Arduino R3 as although there are commercial off the shelf versions available they don't have electrical isolation between the RS485 transceiver and the IO (Input Output) ports. This can be quite critical when connecting up DMX lamps as some of them are not well designed and lets just say ground loops and cheap DMX lamps becoming live when they shouldn't and releasing of magic smoke and electric shocks being a very real and present danger...don't ask me how I know... 

The circuit itself is pretty much the same as those already available.  It has opto-coupling present on the IO, the power supply and has DIP switches on board to set the DMX start address.

Here is the circuit diagram:
DMX to SPI Converter Shield

I suppose I had better explain the circuit - This is as much for me as for the casual reader...I'll be honest I haven't looked at this for a year and some decisions taken were odd to me at first...  

12 V dc input to 5 Vdc out circuit (Switch-mode)


The circuit section shows the 12 V dc input coming from the connector J1 going to C1 (100 nF) - this is a filter capacitor.  Then a DC to DC converter module is present.  Three 100 nF capacitors are then present to filter the output of the DC to DC converter.  These switching converters are known to often cause electromagnetic interference.  The capacitors are present to try to mitigate those issues.

The switching converter (PS1) used is a TRACO TEA_1-505 and it's datasheet is here: 

https://uk.farnell.com/traco-power/tea-1-0505/dc-dc-converter-5v-0-2a/dp/3465028

The next section is the opto-coupled RS485 (DMX)section:


The serial and control signals from the Arduino R3 are connected to Jumpers (JP1 to JP4).  This allows the user to isolate the connections from the serial pins of the Arduino R3 to allow for code upload and control of whether the DMX device will be active (in control of the DMX network and sending data packets) or passive (receiving Data packets).

I'm going to discuss each opto-coupler in turn to simplify things:

Resistor R1 (4.7 kΩ) is connected to output of Opto-coupler U1 and is present to current limit the signal presented to the serial input RX of the Arduino R3 (or clone).  Resistor R6 (470 Ω) is present to current limit the signal presented to the input of U1 coming from the RO output of the RS485 transceiver (U4 - MAX 481E).  


Resistor R2 (470Ω) is connected to the input of Opto-coupler U2 and is present to current limit the signal presented to the internal diode of the device.  The output is current limited by resistor R4
(4.7 kΩ) and is connected to the DE and RE (inverted) inputs of the RS485 transceiver (U4 - MAX 481E). 

Resistor R3 (470Ω) is connected to the input of Opto-coupler U2 and is present to current limit the signal presented to the internal diode of the device.  The output is current limited by resistor R5
(4.7 kΩ) and is connected to the DE and RE (inverted) inputs of the RS485 transceiver (U4 - MAX 481E). 

The Opto-Couplers are powered by 5 V dc coming from the regulated Arduino R3 supply and are isolated from the 5 V dc signal coming from the DC to DC converter 

The IO (A and B) signals of the R485 transceiver (U4 - MAX 481E) are connected to three resistors (R7 - 562 Ω, R8 - 133 Ω, and R9 - 562 Ω).  These are present to provide the 120 Ω impedance matching for the RS485 transceiver.  The input and output to the RS485 transceiver are connected to screw terminals with an isolated return (GND2).  These will connect to the signal cable used to connect this circuit to the DMX controller. 


The next section is present to allow the user to pre-set the DMX address:


The 8 way DIP switches (SW1) are connected to the Arduino R3 spare pins and 330 pull up resistors.  It is a standard way of connecting switches to microcontroller input pins.  The current presented to the microcontroller inputs when the switch is closed is 15 mA which is within the specification of the device (ATMEL 328).

The SPI output of the circuit is taken from Pin 12 of the Arduino R3 along with supply voltage and ground to a three terminal screw connector.  This is a nice robust way of connecting to off the shelf Neopixel circuits. 

The final section is the standard layout used for connecting a shield circuit board to an Arduino R3.


It saves time designing PCB layouts as all of the dimensions and connections are present and contain NET labels.

Here is the bill of materials in case it is needed:


I haven't ordered any of these parts yet but I already know that some are not in stock...the fallout from the pandemic is very real.  Some are due in next week so I can get ordering!

Here is the PCB layout: 


The 3D render is probably easier to see and understand:

The DMX to SPI Converter shield - Top Layer 

The DMX to SPI Converter shield - Bottom Layer

There isn't much to say about the PCB layout.  I've tried to make sure that all of the traces carrying high current are nice and thick. The silk screen labels are visible and it is fairly easy to populate by hand if required.  I wish I had labelled in the inputs and outputs so I know where the GND and +12 V input connections are and where the DMX and NeoPixel connections are.  There are always things I would do differently if given a chance to repeat.

I got ten boards made by PCBWay for a reasonable price and they were delivered in very short order!

Here is a picture of the unpopulated board:


My plan is to populate and test this board as soon as possible as I intend to use it in my next project - the DMX controlled patio lamp :)

That is all for now - take care always - Langster!

Designing a DMX controlled Patio Light with Neopixels

A friend of mine has approached me to make him some Patio lights. He wants them to be interactive! I'm thinking the best idea would be to make him some sort of DMX controlled light with WS2815 LEDS. I can build on the previous design work I have already done which should save me some time. 

For the enclosure my plan is to take an existing garden rock lamp and re-engineer it for this purpose. This should save me having to design some clever aesthetics. To that end I have bought a cheap (£3.20) garden lamp from B & Q - A popular Home / garden improvement chain in the UK: 


The lamp itself looks like this:
   
Simple Garden Solar charging rock lamp

The lamp housing appears to made of some sort of ABS moulded plastic.  The Reflector and LEDS are protected by a simple circular polycarbonate shield.  There is a battery housing and a button on the base of the housing.

Don't turn it on - Take it apart!!!

The deconstructed lamp

The light actually came apart very easily...it was mainly hot glued together!  The reflector, battery box and solar panel will be discarded as they won't have any purpose in the upcycled lamp.  I will probably leave the solar panel on as getting it off will be difficult and it won't do any harm.

There is ample space inside the lamp for a couple of circuit boards and some ballast (weight) to stop the lamp moving too easily.  My current thinking is to design two circuit boards.  One for the DMX and one for the lighting.  The controller will be a small microcontroller board which accepts DMX and outputs SPI to the lighting board.  The lighting board will be a circular PCB with WS2815 LEDS arranged in a sensible pattern.  If I'm luck it will be possible to fit 32 LED pixels on the display board.

I have not decided which microcontroller to use yet...probably an arduino or teensy variant.  There is no need to go for a wifi enabled micro as the plan is to use wire to carry both power and the DMX signal.

The diameter of the reflector is 84 mm.  I think the lamp PCB will need to be the same dimensions.  Hopefully we can get 32 W2815 LEDS (Pixels) to fit!

So to recap our electronic and mechanical requirements:

Design a lamp PCB with 32 pixels.  I think powering the lights via 12 volts might be a good idea however I will consider this more once I get to the PCB layout.  We will need to ensure the tracks are suitably rated for the current flow.  We will fuse the voltage signal on the control board with a user changeable fuse.

Nice to haves: 32 pixels - allows for simple channel assignment via DMX controllers.  Each lamp on one universe...with 96 channels.  

So the design tasks so far:
  • Design a Lamp PCB
  • Design a DMX to neopixel PCB with optocoupled DMX in and out ports - possibly using the one I've already designed.  
  • The micro is yet to be decided.
  • The circuit will also be powered via 12 V dc but we will probably need to regulate that down to 5 V dc for the micro and other circuitry...sound detection, light detection etc.
I haven't got a budget set however cheaper is always better!

That will do for now!  Take care - Langster!


Tuesday, 15 March 2022

Designing a simple breakout PCB for a 3D printing project

 I was approached by a bloke on facebook for a price to design a simple breakout PCB for a 3D printing project he is working on.  As the board was relatively simple and it was for an open source project I decided to do it for him for free.  In return I get to blog about it!

The board itself was part of a 3D printer dual extruder purge controller.  The purge controller uses servo motors to control when a filament change occurs removing the requirement for a purge tower and less filament wastage.  The unused filament is extruded as blobs into a small hopper on the side of the 3D printer.

I must be clear that I did not design any of the circuitry or write any firmware so I cannot assist with the specifics to the project - all I did was layout a PCB.

The circuitry and components used were supplied as a fritzing diagram:

Blobster Fritzing Diagram


The board had to be a specific size to fit an already designed enclosure.  The board size had to be less than 47 mm by 40 mm.  After discussion with the lad on facebook the only parts needed on the board were:

1x Arduino nano every 
1x 15k Resistor
1x 10k Resistor
4x 3 way 2.54' pitch header pins
1x 4 way 2.54' pitch header pins
1x 6 way 2.54' pitch header pins
1x DC barrel jack socket

Everything else will be connected off board via the header pins.

Once all was agreed I fired up kicad and drew up the schematic diagram:

Blobster Schematic Diagram

I then selected all of the PCB footprints.  I actually find it quite useful that Kicad forces you to choose footprints before you start layout.  It prevents you from selecting parts you cannot obtain or solder!

Next I swapped to the PCB design and usually for me I chose to set the board dimensions first and then began arranging the components to suit.  Normally I rotate and move the components around in the rats nest until I get the best electrical connections and groupings and then set the PCB size.

After that was complete I did the routing of the tracks.  There was nothing special about the circuit - no high current traces or impedance matching was needed.  I didn't even bother with a ground plane - I was in a rush!

Here is the final layout:

Blobster PB layout with dimensions

  I also checked the 3D renders out just to make sure all was well.  I really find this feature useful

Top down render

Isometric view of the PCB in 3D

I then plotted the gerber and drill files and sent them to the customer (bloke from Facebook) - He uploaded them to PCBWay and got a quote for £18 including delivery!  I believe all has gone well and he is expecting delivery soon.  I will post images of the boards etc when I get them.

That's all for now - Langster!