Elecrow CrowPanel PICO HMI 4.3″ Display – Review

MakerIot2020.com is usually about my creations, or at least my attempts to create something. Today we shall change that, and publish a Review of the Elecrow Crowpanel PICO HMI 4.3″ Display.

While I usually do not do any sponsored reviews of products, I decided to make an exception in this case. Why? Well, when I received the product documentation for this module from Elecrow, I was immediately interested, since the module fit in perfectly with a project that I was working on, and while it was quite obvious that there would be a huge learning curve involved, with many hours spent chasing documentation and other resources, I believed that the potential functionality and thus gain for my project would make all of this worth-while.

What is this module exactly?

CrowPanel Pico Display is an HMI module series that utilizes the powerful Raspberry Pi RP2040 (ARM Cortex-M0+) as its main controller. It is equipped with a 32-bit dual-core chip running at a clock frequency of up to 133 MHz. With 264kb of built-in SRAM and a 2MB flash memory chip, it integrates power supply, voltage regulation, and counter functions into a single microcontroller. This series of touch screens incorporate high performance, low cost, and user-friendly features.

The Pico 4.3” Display has a 320*240 resolution and capacitive touch for more sensitive control. It has flexible I/O peripherals and a unique programmable input/output (PIO) subsystem, including practical communication interfaces such as I2C, UART, common IO ports, and USB. It also has a built-in BW16 wireless network module, dual-band Wi-Fi (2.4GHz or 5GHz) + low-power Bluetooth 5.0, supports remote monitoring and network management functions, and easily accesses IoT devices and systems. It is also equipped with functions such as a lithium battery interface and a buzzer alarm and can communicate with almost any external device, providing professional users with excellent flexibility and scalability, and achieving seamless connection with the physical world and smart home control.

The module comes with abundant resources, including development SDK, and documentation. It has a very low entry barrier, making it suitable for beginners and hobbyist users. It not only can use Arduino IDE and CircuitPython to program, but also supports the LVGL graphics library and Squareline Studio to customize the desired UI interface. It serves as an excellent platform for machine learning applications and is the preferred solution for Pico-like HMI interaction terminals.

  • 4.3 inch Pico Display: 320*240 resolution, IPS Panel, capacitive touch and support multi-touch
  • RP2040 Microcontroller: Equipped with a 32-bit dual-core chip, it achieves a maximum clock frequency of 133 MHz.
  • Wireless connection: Support 4GHz IEEE 802.11b/g/n and 5GHz spectrum range, support Bluetooth 5.0 and BLE
  • Energy Efficiency: Supports low-power sleep and hibernation modes, promoting energy conservation and environmental consciousness.
  • Exceptional Extensibility: A wealth of interfaces, including I2C, UART, IO ports, USB, a lithium battery interface, and a buzzer alarm, ensures remarkable extensibility.
  • Ease of Use: A user-friendly experience is guaranteed with the provision of a detailed development SDK, and comprehensive documentation, ensuring a smooth learning curve.

Specification


  • Main Chip: RP2040
  • Processor: Dual-core 32-bit ARM Cortex-M0+ @ 133MHz
  • Memory: 264kB on-chip SRAM (supports up to 16MB of off-chip flash memory)
  • Screen Size: 4.3 inch
  • Resolution: 320*240
  • Signal Interface: SPI
  • Touch Type: Capacitive Touch
  • Panel Type: IPS
  • Power Input: 5V-2A
  • Active Area: 95.04*53.856mm(W * H)
  • Dimensions: 124.7 * 76 * 14.2mm(W * H * D)

Unboxing and initial thoughts

The display module came very well packaged.

and includes the display module, a USB-C programming cable and a single 4 way io cable

All the GPIO breakout headers, as well as the Reset and Boot buttons are located on the back of the module. This may be a double edged sword though, as I am still unable to find a way to gain access to these pins without the buttons, while soldering wires directly to them is definitely possible, I really don’t want to do that. Access to these buttons are quite essential, as they are needed to program the device, and once mounted into an enclosure, access to them will be quite difficult, without completely disassembling the enclosure. Time will however tell if this is really a problem or not.

Dissasembly – Looking at the stuff inside

I disassembled the unit because we must look at what is inside – otherwise, we would not be makers, would we? The quality of the PCB seems to be very high, with detailed silkscreen legends everywhere.

Let us take a closer look at a closeup

From what I can see, everything seems well organised, with all relevant circuitry in blocks. The Wifi and Bluetooth module is correctly placed on the right-hand edge of the board, ensuring that we shall have no issues with signal strength, also note that the antenna area is free of tracks and copper pours.

My initial thoughts – about the hardware

The PCB seems to be of very high quality, and the layout of the board clearly required a lot of thought. The unit has a very solid “feel” to it.

However, I do not like the choice of gpio connectors on the board. Screw-type terminals may have been better, at least in my opinion. The Reset and Boot buttons, as previously mentioned are at the back of the board, this may present issues if the panel is mounted into an enclosure. Additional header pins, to enable the installation of external buttons would maybe have been a good idea – time shall however tell if this is really a problem or not.

Supplying power to the board is another issue. Using a USB-C connector is in my view appropriate for bench use. Installing and using this module in a “real-life environment” would require a different type of connector, like a screw-terminal type, that would make it easy to connect power to the unit from more types of power supply units – I am specifically thinking of using it in an Automotive environment, where USB ports are not necessarily always available

Gui Generation – the LVGL graphics library and Squareline Studio

Squareline Studio seems quite sufficient to generate basic GUIs for the display module. The interface is relatively easy to use, and the widgets available is sufficient for a functional, although fairly basic GUI interface. It is possible to code directly in LVGL and add any advanced or customised widgets that way – although this should be done directly in your programming IDE of choice.

It is possible to export your generated GUI directly to Arduino code, and from there make changes to get things working – but with a few very important caveats.
1) It seems that SquareLine Studio suffers from version creep, with new versions popping up in incredibly short timeframes. This means that the latest version does not generate all the required Arduino files anymore – the main .ino file seems to always be missing, with only .c and .h files being generated.

This makes it necessary to perform a few extra steps to get things going ie.
– Copy the example project from Elecrow into a folder – this includes a .ino file
– Remove example Gui related files
– Rename the .Ino to <xxxxxx>.ino (as required by your project )
– export the GUI code into this folder
– edit the .ino file to include you custom code etc…

This results in a successful upload to the board, with a fully functioning Gui… but is a bit of a roundabout way to get things done. Let us see what happens in the future, maybe this will be repaired in future?

Documentation and other Resources

Elecrow has made a lot of written documentation available on their website, here. There are links to all the different RP2040-based Crowpanel modules.
It is however VERY VERY important to note that some of the documentation presented here seems to be incomplete, especially the 4.3″ display module, which uses a completely different display driver than the other members of the RP2040 Crowpanel devices…

I would thus recommend that potential users take a VERY close and detailed look at Elecrow’s YouTube tutorial on these boards, available here. These videos
highlight all the differences, and gets you up and running in a few minutes – with the unfortunate issue of using video to teach technical things – you will have to pause and continue quite a few times… It is however completely worth it in the end, as the information presented is perfect, and invaluable to get started with this module…

Pinout

Pin NameDescriptionConnect Type
PWRPower LED.
RSTReset button. Press it to reset the system.
BOOTHold the BOOT button and press RST button to make the RP2040 enter flash mode.
TF
Provide offline save and extra storage space.
UART0Build the communication among Logic modules, including serial communication module and print module.
GPIO_DConnect with external hardware devices to realize communication, control, or data acquisition with external devices.HY2.0-4P
I2CConnecting microcontrollers and other peripheral devices.HY2.0-4P
BATConnect with the lithium battery. Connect USB-C port to charge the battery.PH2.0-2P
ADCBy analyzing and processing the input signal, the control system can realize the precise control of the controlled object.HY2.0-4P
PICO 4.3-inch HMI PortPin Number
I2CGP2(SDA), GP3(SCL)
UART0RX(GP1); TX(GP0)
UART1RX(GP5); TX(GP4)
GPIO PinsGP0~GP3, GP6,GP7, GP16,GP17,GP22,GP26~28
ADCGP26(SDA),GP27(SCL)

Conclusion – and next steps – for me at least

I am pleasantly surprised with this module. yes, the learning curve is steep, and there are a few very uncomfortable runarounds that has to be performed to use Squareline Studio together with the Arduino IDE to generate GUIs for the module.

We do however have to remember that Squareline Studio and Elecrow are two different companies. The GUI generator has to cater for many different hardware devices. It would thus be unfair to say that the Elecrow Crowpanel module has a problem, just because Squareline Studio requires you to jump through a few hoops to get things working with the Arduino IDE.

I am thus giving the module a thumbs-up and saying all is good. However, I would like to see some improvements in connectors, especially for powering the device, as well as connecting a battery to it, screw-terminals would be much more convenient.

Externally accessible headers for at least the Reset button would also be a very good idea.

Performance-wise, I received a 16mb flash version from Elecrow, and it is snappy, to say the least… the graphics are well-defined and clear, and the touch interface is very responsive.

As mentioned before, the learning curve is steep. This is not a device that you can pick up and start running within a few minutes – You will have to invest some time to get familiar with it – believe me, it will be worth all of that effort!

As for my future projects, I am currently busy interfacing the 4.3″ Crowpanel HIM module with one of my custom PCB projects and will report back more on that once the project is completed.

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

ATTiny1616 Can Bus Controller PCB

Introduction

Over the last few months, we have been working on several prototypes, and some of our regular visitors may recognise some parts of this PCB. But let us begin by telling you what this is about.

As many of you may know, we have already designed several Can-Bus-related development boards, including one based on the ATTiny1616… So why the repeat then? Well, in some of my previous projects, I hinted at combining a buck converter, boost converter, lipo cell charger and Ideal Diode circuit into one PCB. I did at that time not tell you why.

To make a long story short, this project will eventually be used in my car, to provide more modern cabin lighting, which is quite a bit more than the standard on-or-off and on-when-open-the-door, off-when-close-the-door type of thing…

I own an old Honda City that I use mainly for a run-around to and from the farm, as well as seeing clients… Roads are bad, and this older car (actually quite old – 22 years) is the most cost-effective, in terms of being able to repair by myself, and not be worried about it if it gets a bit abused.

Unfortunately, the technology in the car is dated… a single yellowish cabin light right in the centre of the cabin – and not bright at all. Having to use the car at night, and then frequently scratching around in equipment bags when arriving at a client, becomes a pain with bad light… So I have decided to give it a bit of an upgrade and add CAN-bus-controlled NEO-Pixels to the cabin. For now, let’s say three sets, left, right and centre of the cabin. I also prefer a red light at night over white, especially if I have to drive again soon afterwards – a simple remnant from my days in the military, where it became quite clear how white light can temporarily damage your night vision.

NeoPixels can also be dimmed/brightened and seem relatively inexpensive.

Let us take a closer look at exactly what I want to do…

Powering the module

For the sake of clarity, this particular module will be installed front and centre in the cabin, just behind the rearview mirror. It will control two sets of 8 neopixels ( or up to 12 per module ) on two separate PCBs, which will cover the driver and front passenger area of the cabin.

The module will be powered by the vehicle’s 12v battery, as well as from a single 18650 Lipo cell. This means that we would need some clever tricks, in the form of a buck converter to step down the 12v to 5v, a way to monitor and recharge the lipo cell, a boost converter to boost the lipo cell voltage back up to 5v as well as a voltage “OR-ing circuit” to prevent reverse charging the lipo cell etc…

In its current state, the PCB is to be considered a test rig, since I have quite a few unknown variables that need to be thoroughly tested before actually installing this thing into a vehicle.

These are :
1) I would like to know if the ideal diode chip that I used functions well when used in a parallel setup, The reason for that is, that a single chip is capable of just about 1A of current… thus, in my reasoning, placing 3 in parallel would give me the 3A capability that I require – Let’s see if it does…
I could also not get hold of a suitable 3A capable ideal diode chip that was cost-effective, or did not have some strange MOQ or other logistics issues ( Yeah, seems like getting some stuff in SE Asia is difficult unless you are willing to pay unnecessary “special” charges and import duties etc … Element14 ( not sponsored) seems to have a limited selection of ideal diode solutions, but their pricing is good, and there are minimum hassles with shipping etc… I don’t bother with the other two big suppliers, D…. and M…. as they have too much red tape for a hobbyist to navigate to make it cost-effective to shop from them.))

2) Providing that the ideal diode solution does work as expected ( on the PCB) – having tested it on a breadboard seems to be working fine, there is the issue of monitoring the lipo cell, getting it charged, controlling the boost converter to provide power when needed etc…

All of this means that all the separate circuit modules on the PCB can be enabled or disabled by jumpers, and later, if all works as expected, maybe by another controller PCB… Who knows?

Getting back to power the PCB, I have used my standard buck converter circuit, based around the MP9943. This circuit seems to be very reliable, provides enough current, and is cost-effective.

I have also provided an auxiliary voltage output ( 5v) and some telemetry and control capability to the buck converter circuit, in the form of an enable-disable jumper, and the PG signal from the chip, to maybe be interfaced with a microcontroller later.

Charging the Lipo Cell

Once again, I made use of an existing circuit, with which I have had a lot of success in the past. This circuit, based on the MCP73832 from Microchip ( not sponsored) served me quite well in previous projects, and is once again, cost-effective and easy to implement. One negative is that they do seem to be a bit finicky, and not extremely robust – but when they work, they excel at it…

Once again, I decided to provide control logic to enable or disable this part of the circuit completely if needed.

Supply “OR-ing” circuit

This is the most experimental part of this entire circuit board, since, as mentioned above, the MAX40200 is rated at 1A maximum current. It is tiny and cheap, and also readily available… I am hoping that by using them in parallel I can achieve my goal of allowing the full 3A of current to flow from the buck converter, without releasing any “magic smoke” or other issues…

While, at the time of writing, I have not yet received the PCB, I am positive that all may just be fine, it remains to be seen how this will turn out during actual testing of the board.

Note that I have used a total of 6 of these, U8 to U11, with 3 per “voltage/current supply” channel. J3 and J4 are used to enable or disable the two supplies, with J3 being the buck converter input, in turn, powered from the vehicle 12v supply, and J4 begin the output from the boost converter, powered by the Lipo cell.

Boost converter circuit and MCU power

The boost converter is based on the MP3423, also from Microchip ( not sponsored). This circuit also performed very well in my initial test projects, with the only issue being it extremely tiny footprint, which really makes it quite difficult to use in a hobby environment, even with hot air and reflow equipment available… It is however also quite cheap, and readily available…

J5 provides enable-disable control to this part of the circuit.

With this relatively complicated power supply circuit, I thought it necessary to be able to completely isolate the ATTiny1616 and other integrated circuits from any power until I am completely sure everything works as planned…

J6A and J6B thus form a complete electrical isolation “breaker” that will prevent any voltage being provided to the microcontroller and other components on the PCB. I have doubled up on these jumpers, to allow for sufficient current flow, since I plan to use quite a few NeoPixels on this PCB… With up to 60mA of current required per pixel, that quickly adds up…

Voltage monitoring

Provision was made to monitor the output voltages of the Lipo Cell, and buck and boost converters by using the analog inputs on the ATTiny1616. These can be selected by setting the jumpers on J9, J10 and J11

Alternatively, the analog inputs can be used for other applications be leaving the jumpers off, in which case these GPIO’s will be available on H6 as PA4, PA5 and PA7

The ATTiny1616 microcontroller and UPDI programming port

The heart of this PCB is the ATTiny1616 microcontroller, (microchip, not sponsored)

I decided to use the chip once again due to its low cost, as well as the fact that I do not need a very powerful processor for this application. The only issue is that requires UPDI programming. In my case, I have had no issue with that yet, but other readers did mention that they had issues with them…

The UPDI header is at H1. This header can also be used to power the processor and other integrated circuits on the PCB independently from the Power supply, like in the case where J6A and J6B are left unconnected. This use case will provide me with more testing opportunities to test the board without possible variables from the power supply circuit(s).

Peripherals like I2C and the UART were broken out onto headers H3 for I2C, H4 for UART. These can also be used as GPIO pins ( remember to disable the I2C pullup in J1)

CAN-Bus Support

CAN-Bus support is provided by the MCP2515 (U2) and TJA1050 (U3) chips.

With access to the MCP2515 GPIO pins on H5. J2 is a 120ohm termination resistor, usually enabled at the start and end of the bus to prevent reflections.

CAN-0 is connected to the bus.
An additional 12v input/output header is provided at H7

NeoPixel Header H2

The NeoPixel strips are connected to H2. They are controlled from GPIO PA6 on the ATTiny1616. I have designed around a total of 24 of these at a maximum, with a total current requirement of 1.4A ( 24 x 60mA max per pixel / 1000 = 1.44 A) .

One important fact to know about NeoPixels is that the consume about 1mA per pixel even when in the OFF state. This is due to the internal control chip requiring power to operate. While 1mA bay be a very small amount of current, a lot of them does however quickly add up, and can thus potentially drain a battery completely over time…

To prevent this from happening, I have included a PMOS switch on the VCC pin at H2. This means that no power will be fed to the Neopixel strips unless you specifically pull GPIO PC1 low.

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 project has a lot of specific details regarding testing and assembly.
Therefore I have decided to put all of that in a separate post, that you can access
here.

18650 Cell Boost Converter

As part of an ongoing project, this tiny boost converter was designed to be used to power some of my projects, as well as become a part of a much-needed add-on circuit to the single-cell 18650 charger PCB that I designed a while ago.

I received a lot of very useful comments from readers about the circuit below ( the single-cell 18560 Lipo charger). Most of these comments were related to adding a boost converter to the circuit, to add a little more versatility to the circuit.

I never just add something though, and as such, this boost converter prototype was designed to test out the components and design before incorporating it into the main design. That way, I can iron out any problems before adding it to a bigger circuit.

The boost converter is based on the MP3423GG-Z, from MPS. I have decided to stay very close to their recommended application notes, so the circuit is stock standard. Another way to ensure that performance is what I want it to be, and also, to be frank, because I don’t believe I need to make any changes to the manufacturer-recommended circuit.


Some other comments suggested the use of “ideal diodes” at the output , in order to be able to daisy-chain the chargers. That will be addressed in a later post this month, as I am also currently testing out one of the many “ideal diode” integrated circuit chips available – in this case the MAX40200.

Being a “prototype” I did not bother with adding proper connectors to this version, as it will only be used for a short while. Soldering the supply and output wires directly to the PCB will thus be sufficient for the time being.

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

Find out more here

Assembly

This PCB really would benefit from having a stencil available when you assemble it by hand. The MP3423GG-Z is super tiny, so having a guide to apply just the right amount of solder paste to the pads will go a long long way to make sure that there is no reworking needed.


All of the other components are quite manageable, being only a couple of 0805 and 0603 resistors, and an inductor. I reflow soldered everything at the same time with a hotplate. It is worth noting that I did have to remove and replace the MP3423GG-Z once during the reflow process… tiny solder bridges formed between some pins, but carefully lifting it up with a pair of tweezers, and placing it onto the pads again got rid of those completely.

We may be tempted to “leave it off the board, wait for the solder to flow and then place the component onto the molten solder…” I am not too sure about the thermal stresses that that method may or may not induce in the component… so, I prefer having it heat up slowly with the rest of the components/ and then make a quick adjustment if needed… Comments on this anyone?

Testing and final thoughts

Testing the boost converter went without any problems. It delivers a stable 5.15v DC at the output, from an input voltage of 3.3v to 4.2v. I did not test it lower than that yet… Current output seems quite stable, and the voltage does not fluctuate under load ( I tested with 2 LED COB lights, each drawing 600mA, connected in series – thus 1.2A — That is definitely the maximum current that I intend to draw from this device, although it is rated at 3A

Ripple current seems to be within the 100mV stated in the datasheet.

In summary, I believe the device performs the intended duty that i set out to design. The assembly is a bit tricky due to the small size of the MP3423GG-Z, as well as my “not-so-good” eyesight. All that aside, I am ready to advance to the next phase of the overall project – revision 2 of the Single Cell 18650 Lipo Charger.

Lipo Cell Charger Rev 2.0 – A Combination of various circuits

A few months ago, I designed, what seemed at that time like an elegant solution to solve my 18650 Lipo cell charging issues. After publishing it online, I received quite a lot of extremely useful comments, most of which highlighted some of the shortcomings of that circuit.

Well, circuit is my attempt to address some of those, and turn the circuit into something that is actually useable…

What is on the PCB

To answer this, let us start at the core and work outwards. The 18650 Lipo Cell is charged using an MCP73832T chip. This chip will charge the cell up to a nominal voltage of 4.2v DC and accept an input of up to 6.0v DC…



This presented me with my first problem, as absent-minded me accidently fried quite a few of them when accidentally connecting 12v to a PCB…

My solution to this was to add a Buck converter, based on my previous 3A Buck converter circuit(s) using the MP9943GQ from MPS. The buck converter can accept between 7v to 12v DC and output a stable 5.3v DC, saving me from frying chips, and also making it useable with most of the power supplies lying around in my lab – and it can also be used in the car at a later stage — Future project —

While that keeps the MCP73832T happy, and the 18650 cell charged, the next problem that presented itself was the nominal voltage of the 18650 cell itself, which is usually between 3.2v and 4.2v. In order for this voltage to be universally useful to me I needed a boost converter to increase the output to 5.15v.

This boost converter was built around the MP3423GG, also from MPS. This tiny little 14 pin IC provides the 5.15v that I need with ease, at a rated current of up to 3A. Ideal for powering other peripherals, like LDO regulators to power an ESP32 etc…

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

The assembly of this PCB was quite challenging, to put it lightly. 3 QFN chips, with different pad spacing, and small sizes really tested my limits. Needless to say, proper equipment is a must, and even then, a very steady hand and good magnification will go a very long way towards ensuring success… Another option would definitely be to have the PCB professionally assembled…


A stencil is definitely required for this one, is only for that 14-pin boost converter IC, to make sure that the amount of solder paste is just right – and even then, it is still a challenge!

Summary

This was a challenging build that tested my assembly skills quite a bit. The circuit functions like intended. Now it is time to add some more features, like an ideal diode chip at the output, to allow for daisy chaining the lipo cells if required, as well as maybe a microcontroller to control power to the buck converter when the battery is not being charged.

MAX40200 “Ideal Diode” Lipo Cell OR-ing prototype

This short post will cover a quick experiment using the MAX40200 “ideal diode” chip. I have plans to incorporate this device into my Lipo Cell charger to allow for combining cells to provide longer run-time for my projects, as well as using mains power where available.

For this reason, I replicated the manufacturer evaluation circuit for the MAX40200 chip to test it under my typical operating conditions.

I include a very detailed description from EZ.Analog.com below

There are three primary applications for ideal diodes. One is simple reverse voltage protection for a battery-operated device. This is simply a diode in series from the battery to the application circuit. The second is as a diode OR for high-reliability redundant power supplies. Last is the same diode OR circuit, but for a selection circuit between an on-board rechargeable battery and a wall charger—just like your cell phone and many portable equipment have. Ideal diodes (such as the MAX16915) are also used for overvoltage protection on power inputs.

A designer could move from a standard diode to a Schottky diode in all three of the applications mentioned. That will be a big help with forward voltage drop with the voltage going from 1.1V for a standard diode to around 0.45V at a 1A forward current. But, an ideal diode will take you down to 85mV at that current, and they don’t cost much. Plus, they are much, much smaller. An ideal diode IC reduces power consumption, cuts voltage loss (important when coming from a low-voltage battery), and will take less PC board area. Besides, they solve a big Schottky problem. Schottky diodes have a very high reverse leakage—around 1mA for the 1A device. This leakage is not good for primary batteries, in particular. An ideal diode typically has a reverse leakage of less than 1µA over temperature.

There are three ways to get ideal. You could make your own, use a driver IC for an external FET, or use a device with an integrated FET. Driving the FET is not as easy as you might think. It’s important that the drive circuit control the forward voltage drop across the MOSFET to ensure smooth current transfer from one path to the other without oscillation. If the power source fails or is shorted, a fast turn-off minimizes reverse current transients. Implemented correctly, an ideal diode can provide front-end protection against reverse battery conditions, overvoltage transients, and inrush current. Ideal diode controller ICs, using external FETs, are available with current ratings up to 5A and voltage rating to 80V.

A great example of a complete ideal diode device is Maxim’s MAX40200, which operates from a supply voltage of 1.5V to 5.5V, handles up to 1A, and comes in a tiny 0.73mm square 4-bump WLP or a SOT23-5 package. It is thermally self-protecting and works over -40° to 125°C. When disabled, the MAX40200 blocks voltages up to 6V in either direction.

The functional diagram in Figure 1 shows a unique symbol for the internal FET. The p-channel FET has added circuitry to sense the MOSFET drain-to-source voltage and, in addition to driving the gate, keep the body diode reverse biased.

It should be noted that, unlike normal diodes, this “ideal diode” is not suited for rectifying AC. In applications where the supply is an inductively coupled 60Hz AC, conventional diodes should be used for the rectification part of the circuitry. MAX40200 is designed to be used in applications to switch between different DC sources. The chip exhibits a regulated ~20mV voltage drop up to 100mA of forward current. Above that, the forward drop increases to roughly 90mV at the maximum rated forward current of 1A. This small voltage drop will increase efficiency and significantly increase battery operation times. The IC’s dynamic response is detailed in an application note, “Static and Dynamic Behavior of the MAX40200 in a Diode ORing Application.” And, an evaluation kit, MAX40200EVKIT, is available.

For example, a AAA battery has 1Ah capacity at ~3V for two cells. If a Schottky diode drops 0.36V at 1A and our MAX40200 drops only 0.09V, the 0.27V difference yields 0.27Wh saved. So your device will run an extra quarter hour at the 1A maximum load.

The IC has a thermal shutdown temperature of about +154°C with 12°C hysteresis. if currents exceed ~500mA, care must be taken in your design to not exceed this temperature. The thermal performance of the WLP package actually exceeds that of the SOT package.

What is on the PCB ?

The PCB is very loosely based on the  MAX40200EVKIT from MAXIM. I decided to design my own version versus buying the evaluation kit because it will , at least in my opinion, give me a better understanding of the component if I use it in a design that I have slightly modified…

What modifications did I make?
Not a lot, to be honest. I added two status LED’s and enable/disable jumpers.
Except for that, the circuit is stock standard from the example provided by MAXIM.

Why did I design this PCB?

The PCB was designed to thoroughly test the Diode “Or-ing” circuit, and to determine if it would function correctly when combined with my other circuits:
In this case, it will be incorporated into my LiPo Cell charger in the near future.

Testing the design

I am quite happy to say that, at least to me, everything seems to be working as expected. I measured a reverse voltage of below 120mV at the input of a disabled device, and the voltage drop of an enabled device is also below about 120mV.

The OR-ing function works quite well, as well as running the two MAX40200 chips in parallel, i.e. with both enabled. This resulted in a sort of “hot-standby” configuration, where the load is powered by the highest “supply” and then almost seamlessly switched over to the other when the first supply is removed…

This functionality does however require some more testing, as I am currently unsure if it is within the recommended operating parameters of the device, as well as if the perceived “hot-swapover” is as seamless as it seems… for example, while powering a 5v LED COB light from a bench power supply at 5.3 v, there is a noticeable diming of the LED when the bench supply is removed and the circuit runs only on the 18650 Lipo cell, which is boosted to 5.15v… with a subsequent brightening of the LED once the bench supply is reactivated…

This leads me to believe that the dimming may only be due to slight voltage differences, and could thus confirm my idea that a hot swap over is actually possible.

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

Assembly is straight forward, with not difficult to-assemble components on the PCB. I did however order a stencil, as it is just part of my work-flow.

It is however completely possible to assemble this board completely by hand using a very fine tip soldering iron.

Conclusion

Using new devices – new to me, because I have not really encountered them before – can be quite exciting, especially if things turn out the way you expected, or even better than that. The challenge from this point onwards will be to properly incorporate the MAX40200 into the proposed circuit, as well as dynamically controlling each of the two MAX40200 chips to be enabled/disabled at the right time and at the right condition.

A Student designed ESP8266 Dev Board


This is a student-designed ESP8266 Dev board. This project came along after I challenged some final-year students at our local high school to try to design their own PCBs. They had recently assisted me in a collaboration with the Mushroom House Controller project, and while we were talking about electronics, the idea of a challenge came up, to stimulate some interaction.

One of them was extremely confident that he could do it, providing that I gave him a schematic. I complied, and he spent the next week hacking away on the EDA software. When i saw him again, he very proudly handed me a USB flash drive, containing the EDA design, but no schematic! Oh well, let us take a chance and see what happens… I mean, how bad could it be…

I took a good look at the design, making sure that it was at least electrically sound, with all the connections made to the right components, in the right way.

That part all passed, but, as we can clearly see, the layout could be very much improved. I decided to NOT change anything on the PCB, to keep the work original.

Manufacturing the PCB

The PCB, together with a stencil, arrived from PCBWay on about the 15th of this month.

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

The PCB was assembled with help of a stencil.

Technically, this PCB does not actually need it, as the components are large enough to manually place solder paste. This being a student project, I did however choose to get the stencil to try and assure the best possible chance of success..

Placing components only took a few minutes, after which the PCB was reflowed with hot air – no need for a hotplate here!

Through-hole components took only another few minutes to solder into place, and then testing could commence.

My thoughts – a very “gentle” critique

The board could be smaller, but due to the fact that this is a “very first PCB ever” and also a first SMD PCB at that, I can understand that it may still be quite difficult to understand how small the components really are, as well as lay them out properly.

Components are mostly all over the board, without a clear “group by function” kind of mindset. This once again comes back to experience.

GPIO pins are not notated. This will really make the board difficult to use.
The power supply input is in the center of the PCB. This is definitely not ideal.

In general, track sizes could have been bigger, especially on the Power and Ground lines. No ground plane was poured on either layer.

So does it work?
Yes, surprisingly it does. We shall see more of it in the near future, when I task the creator with using it to perform some task. That way, he can experience first hand the difficulties of the design, and also learn practically why certain things need to be improved.

A Simple IoT Plant Watering Solution

This is a Simple IoT Plant Watering Solution, done as another collaboration with the local High School in my Area. In this project, they took a group of purely academic students ( Language majors ) and told them that they had to design an electronics project that would have use in the real world…

This presented a very tough situation to the students since they had never even imagined that they could do something like this… (Think along the lines of a Senior Design project, like what you would give EE Students during their final year – with all the documentation, pamphlets, and explanations – i.e. lots and lots of paperwork) , and then also add on the requirement that they had to present a practical project as well! And they have only 45 days to do that as well!

I came into this picture late on a Thursday or Friday afternoon, with a group of students milling around outside the Electronics lab. They were unknown to me and seemed quite flustered… I invited them in, and eventually, they started opening up about their problem…

As it turned out, they were completely clueless, and did not know where to start with anything, not even what they wanted to do! Their initial idea went like “something that uses a camera to sort garbage by type and material” – that was never going to happen, not in 45 days, and not with the allocated budget of no more than $USD30.00 they were allowed. Lets not even go to the machine learning stuff, training of the models etc…

So, I took over, and decided that we shall do a simple IoT Plant Watering Solution. It is complex enough for Grade 11 students, and more importantly, I knew that I could teach them enough Arduino coding and basic electronics skills in the time allotted to get the project completed successfully.

What followed was a few very intensive sessions after school to get the paperwork sorted. For some reason, their teacher required ALL paperwork be completed upfront, with the entire design and code prepared before they touched the practical stuff – A funny way to design stuff if you ask me, but that is how we did it…

We settled on the ESP8266 12-E NodeMCU v3 development board, A resistive soil sensor, a DHT11 for temperature and humidity data, a small OLED I2C display and a small 5v USB-powered water pump. While they ordered the components, we started with basic coding classes, and this is where the story changes.

These kids blew me away with their level of interest, their attitude to learning, and how quickly they grasped the concepts. In no time at all, they were coding basic sketches, taking readings, learning how the different sensors worked, and pushing the envelope by adding lots more complementary components like MOSFETs and BJT transistors.


With this level of enthusiasm, I could not help but also become very excited, and thus decided to go a bit further than usual and help them design a neat PCB baseboard for the NodeMCU. That way, we could get rid of all those pesky wire connections, and maybe even produce something that looked good.


This is what we came up with, here shown just after SMD component placing. They ( the students ) did all of that by themselves as well, and it turned out to be a lot of fun for them, with some funny moments for me as well.

The Assembly ( First time ever )

The PCB, together with a stencil, arrived from PCBWay on about the 15th of this month.

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

This caused quite a lot of excitement from the students since they asked me to get to school immediately, and offered to stay after school to get the assembly done. So, I packed up all the components required, got in the car, and a few minutes later, we had an assembly line running 🙂


It took them only a few minutes to understand how to read the BOM file, use that information to find the right components and take turns to place a few components at a time onto the PCB. ( I did the solder paste and stencil thing on my own, as that could potentially turn out to be a very messy and wasteful operation if I let them do it )

During this assembly, they were quite amazed at what they were doing, but also quite confused as to how we would ” make the components stick to the PCB later”. They have seen soldering on YouTube, and could not understand how this “grey paste” could “turn hard and shiny” – with some even trying to rush their friends, as the paste would dry up and become sticky…

That signalled to me that we should get the hot air ready, and show them properly, as it would stop the speculation, and give them closure on their questions, because no matter how much I tried to explain that the solder paste would be melted later, they could not understand that concept.


Once I reflowed the first few components using hot air, they all once again took turns with a small group of components on the PCB ( We assembled 2 PCB’s to make sure everybody got a chance to try everything)


Through-hole soldering of the various header pins and other components was next. Once again, I showed them an example and then stepped back while they took over and completed the task. At this time it was about 17:30 already, so I sent them all home, with a promise to return the next day and complete the rest of the build.

Final Assembly and the Enclosure


We added some copper standoffs to the bottom of the enclosure, drilled some holes and mounted everything with screws and hot glue. The some final testing was performed, and the project was placed outside, next to a potted plant, and put on a sort of soak test, to verify operation for a few days.

A discussion of the circuit

In this circuit, I made use of a very cheap resistive soil moisture probe sensor. It consists of an etched PCB probe and a separate OPAMP on an additional PCB. This assembly then sends an analog voltage back to the Microprocessor for analysis. Very easy to use, and as mentioned, extremely cheap! But this is also a big problem. As seen in many other posts online, people don’t like these probes, as they don’t seem to last very long, and/or become unreliable over time.

I believe that this is due to the fact that they run them continuously, and that, causes the electrodes to erode away over time – because the thing about it, you are basically running an electrolysis cell – sending voltage/current through a probe, that is suspended in a conductive medium ( the water in the soil contains minerals etc – that is why it is conductive, and why we can get a reading from it )

How do I plan to avoid this problem then? The probe is powered through a small N-Channel MOSFET. This allows us to power the probe on when we want a reading, and then power it off again. It will definitely not completely stop the electrodes eroding away over time, but I am sure it will extend the usable lifetime of the probe by quite a bit. On the downside, you need another GPIO pin to control that MOSFET, but that in itself is also a great learning opportunity

Code

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32


#define DHTTYPE    DHT11     // DHT 11
#define WaterRelay 2
#define A0Enable 14
#define DHTEnable 13
#define DHTPIN 12
#define WATER_DELAY 10000
#define WATER_LOW 20.00
#define SOIL_DELAY 5000

uint32_t delayMS;
float temperature = 0.00;
float humidity = 0.00;
float soilValue = 0.00;
float soilAverage = 0.00;
unsigned long previousMillis = 0;
unsigned long previousWater = 0;
unsigned long previousSoil = 0;
bool MAY_WATER = 0;
bool RUN_WATER = 0;
bool DELAY_WATER = 0;
sensor_t sensor;
const String WaterOn = "Waterpump ON";
const String WaterOff = "Waterpump OFF";
String WaterMessage = "";

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
DHT_Unified dht(DHTPIN, DHTTYPE);



void setup() {
  
  pinMode(WaterRelay,OUTPUT);
  pinMode(A0Enable,OUTPUT);
  pinMode(DHTEnable,OUTPUT);
  digitalWrite(WaterRelay,HIGH);
  //Serial.begin(115200);
  if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    //Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }
  display.ssd1306_command(SSD1306_DISPLAYON);
  display.clearDisplay();
  display.display();
  delay(20);
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(10,10);
  display.print("Booting...");
  display.display();
  delay(2000);
  
  dht.begin();
  
  show_DHT_Params();
  
}

void loop() {
  
  
  

  //Soil Monitor Loop
  unsigned long SoilMillis = millis();
  if ( SoilMillis - previousSoil >= SOIL_DELAY) {
    previousSoil = SoilMillis;
    take_soil_reading();
  }
  //End Soil Monitor Loop

  //Water Loop
  unsigned long WaterMillis = millis();
  if (WaterMillis - previousWater >= WATER_DELAY) {
    previousWater = WaterMillis;
    if ((digitalRead(WaterRelay) == LOW) && (RUN_WATER == 1) && ( DELAY_WATER == 0)) {
      digitalWrite(WaterRelay,HIGH);
      DELAY_WATER = 1;
    } else if (DELAY_WATER == 1) {
      DELAY_WATER = 0;
      if (RUN_WATER == 1) RUN_WATER = 0;
    }
  }
  // End Water Loop
  // Main One Second Delay Loop
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= delayMS) {
    previousMillis = currentMillis;
    get_DHT_Readings();
    show_Soil_Data();
    display.display();
  }
  // End Main 1 Second Loop
  if ((soilAverage < WATER_LOW) && (RUN_WATER == 0)) {
    RUN_WATER = 1;
    MAY_WATER = 1;
  } else if (soilAverage >= WATER_LOW) {
    RUN_WATER = 0;
    MAY_WATER = 0; 
  }

  if ((digitalRead(WaterRelay) == HIGH) && (RUN_WATER == 1) && DELAY_WATER == 0) {
      digitalWrite(WaterRelay,LOW);
      WaterMessage = WaterOn;
      take_soil_reading();
  }
  if ((DELAY_WATER == 1) && (MAY_WATER == 1)) {
      digitalWrite(WaterRelay,HIGH);
      WaterMessage = WaterOff;
  }
  
}

void take_soil_reading() {
  digitalWrite(A0Enable,HIGH);
  delay(50);
  
  float tempSoil = 0.00;
  for (int i = 0; i <10 ; i++) {
    soilValue = (1024.00 - analogRead(A0));
    tempSoil = tempSoil + soilValue;
    delay(2);
  }
  soilAverage = map(tempSoil/10,0.00,1023.00,0.00,100.00);
  delay(30);
  digitalWrite(A0Enable,LOW);
}

void show_DHT_Params() {
  digitalWrite(DHTEnable,HIGH);
  
  dht.temperature().getSensor(&sensor);
  display.clearDisplay();
  display.display();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(10,1);
  display.print("Temperature Sensor");
  display.setCursor(10,10);
  display.print(F("Type: "));
  display.print(sensor.version);
  display.setCursor(10,20);
  display.print(F("Min: "));
  display.print(sensor.min_value);
  display.print(F(" Deg C"));
  display.setCursor(10,30);
  display.print(F("Max: "));
  display.print(sensor.max_value);
  display.print(F(" Deg C"));
  display.setCursor(10,40);
  display.print(F("Resolution: +/- "));
  display.setCursor(10,50);
  display.print(sensor.resolution);
  display.print(F(" Deg C"));
  display.display();
  delay(4000);
  dht.humidity().getSensor(&sensor);
  display.clearDisplay();
  display.display();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(10,1);
  display.print("Humidity Sensor");
  display.setCursor(10,10);
  display.print(F("Type: "));
  display.print(sensor.version);
  display.setCursor(10,20);
  display.print(F("Min: "));
  display.print(sensor.min_value);
  display.print(F(" % RH"));
  display.setCursor(10,30);
  display.print(F("Max: "));
  display.print(sensor.max_value);
  display.print(F(" % RH"));
  display.setCursor(10,40);
  display.print(F("Resolution: +/- "));
   display.setCursor(10,50);
  display.print(sensor.resolution);
  display.print(F(" % RH"));
  display.display();
  delay(4000);
  
  delayMS = sensor.min_delay / 1000;
}

void get_DHT_Readings() {
    
    display.clearDisplay();
    display.setTextSize(2);
    display.setTextColor(SSD1306_WHITE);
    sensors_event_t event;
    dht.temperature().getEvent(&event);
    if (isnan(event.temperature)) {
      #ifdef DEBUG-SERIAL
      Serial.println(F("Error reading temperature!"));
      #endif
    }
    else {
      display.setCursor(10,1);
     
      display.setCursor(10,1);
      display.print(event.temperature);
      display.setCursor(80,1);
      display.println(F(" C"));
      temperature = event.temperature;
    }
    // Get humidity event and print its value.
    dht.humidity().getEvent(&event);
    if (isnan(event.relative_humidity)) {
     display.clearDisplay();
    display.setTextSize(2);
    display.setTextColor(SSD1306_WHITE);
    sensors_event_t event;
    dht.temperature().getEvent(&event);
    if (isnan(event.temperature)) {
      #ifdef DEBUG-SERIAL
      Serial.println(F("Error reading temperature!"));
      #endif
    }
    else {
      
      display.setCursor(10,1);
      display.print(event.temperature);
      display.setCursor(80,1);
      display.println(F(" C"));
      temperature = event.temperature;
    }
    // Get humidity event and print its value.
    dht.humidity().getEvent(&event);
    if (isnan(event.relative_humidity)) {
      #ifdef DEBUG-SERIAL
      Serial.println(F("Error reading humidity!"));
      #endif
    }
    else {
      display.setCursor(10,20);
      display.print(event.relative_humidity);
      display.setCursor(80,20);
      display.println(F(" %"));
      humidity = event.relative_humidity;
    }
    }
    else {
      display.setCursor(10,20);
      display.print(event.relative_humidity);
      display.setCursor(80,20);
      display.println(F(" %RH"));
      humidity = event.relative_humidity;
    }
    
}

void show_Soil_Data() {
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(10,39);
  display.print(soilAverage);
  display.setCursor(80,39);
  display.println(F(" %"));
  display.setTextSize(1);
  display.setCursor(10,56);
  display.println(WaterMessage);
}

Conclusion

This project was extremely interesting. It was something very basic, but it gave me a very unique opportunity to teach a group of kids something they never knew before. It also initiated a spark in many of them, who are now interested in getting involved in electronics as a hobby. The possibilities of this project, if it is improved a bit more, could also be great. For example, we did not even consider adding IoT connectivity to this yet, we all decided that it was not needed, and an unnecessary complication of an already complex issue ( to the students that is). I shall keep monitoring the operation of the device over the next few weeks, and hopefully get some answers myself as to how long that soil probe will last… As a control, we have another one that was left powered on in the same container. That one are not being used to take readings, but will definitely provide us with a good comparison against the probe that is only on then used…