Saturday, October 24, 2020

KiBoard 3, again an Arduino Clone

The year 2020 is almost over now. Unfortunately, my job is very busy during the COVID19 pandemic. Today (October 2020) I have a real vacation for the first time this year. I used the time and developed 2 boards. Not really anything new. It's Arduino compatible boards with Atmega328 again. They contain a buck regulator, 3.3V LDO regulator, EEPROM, buzzer and an RTC (DS 1307 or DS3231). These boards are designed to be mounted with spacers on the back of a 1602 LCD display, which contains an I2C adapter. I decided again for an I2C display and deliberately did not choose a parallel connection because it "eats up" too many pins.
A UART header is available to connect a USB converter.


I ordered only the boards for the DS3231 version from JLCPCB.
I did not order the version with the DS1307 and will test it at a later date.



Today I got the PCBs from JLCPCB. I then assembled and tested 3 boards of the DS3231 version. It all looks very good. The board fits perfectly on the back of my 16x2 LCD display and everything seems to be working.
Fortunately, it contains protection against reverse polarity of the operating voltage (7 - 24V). Otherwise I would probably have grilled one of the circuit boards :-) ...






My KiCAD project files can be downloaded from my Google Drive:
Google Drive

There is another archive in the ZIP files. This can be uploaded directly to a board manufacturer (I use Seedstudio or JLCPCB) to order professional PCBs in your desired color.

My project is free for private use. It is aimed at experienced people. I take no guarantee! Duplication is at your own risk and responsibility!
You are welcome to customize or modify my project and publish it. However, you always have to refer to the origin!
 
Update 2/2021
I have finished my device. I added two p-channel power MOSFETs. Now it controls the lighting in my aquarium. The special thing is that I can now control the colors blue and white of my lighting separately. Now my fish have a blue night light and daylight that is accurate to the minute. And all of this is softly dimmed without stress.


 

Monday, October 12, 2020

Rotary encoder secret decoded ...

There are many pages that deal with rotary encoders in connection with Arduino. Numerous diagrams with square-wave signals are published and reports on a shift in the signals depending on the direction of rotation. All of this is correct. But I was often missing a small but important piece of information.

What exactly happens when the encoder is only rotated one stop point further?

Unfortunately, this is not understandable for me from the many technical descriptions.
I couldn't explain it clearly to myself, so I just hooked up my own oscillograph. An example from the ardino accessories was used as an encoder. Pull-up resistors are already built in here.


 

I operated this with 5v and tapped the signals at CLK (yellow) and DT (blue). And now it looks very simple:

This is the information that I have always lacked in order to understand it:

The (my own) rotary encoder generates a complete single pulse on the CLK and DT, while the rotation continues by one detent point. In the idle state, both connections are at HIGH level. 

Depending on the direction of rotation, there is a time lag between the two signals. The trigger point would be the edge from HIGH (logic 1) to LOW (logic 0) at the CLK connection (or alternatively the rising edge). In order to determine the direction of rotation, you only have to determine the level at which the 2nd output is at this point in time. Exactly at this moment the level at the DT connection is always LOW when turning in one direction or always HIGH when turning in the other direction. I have framed this point in time in red in the screenshots of my oscilloscope.

Sunday, December 1, 2019

Universal ATmega 328p Board



Often there is a need for an Arduino project to control various power consumers. These can be low-voltage consumers, which should also be controlled with PWM. On the other hand, it can be about consumers who just want to turn on or off with relais. Of course, there are appropriate modules on the market that just need to be plugged. But when sensors and other modules are added, it gets confusing because of the many cables.
That's why I've developed a small PCB that contains some commonly used components, but also includes 2 power mosfets and 2 relays. As MCU serves the well-known ATmega 328p. The designation of the pins is Arduino Nano compatible. For a USB function you have to install the corresponding bootloader and connect a USB / TTL converter.
In the Arduino IDE the harddware must be adjusted accordingly on Arduino Nano.



The following features distinguish this board:
  • Buck Regulator with LM2596
  • Real time clock with DS3231
  • EEPROM socket
  • To control the buzzer and the relays the analog pins are used as output (A0, A1, A2)
  • 2 Power MOSFETs (FDD8447L) controlled via PWM connected to D9 and D10
  • The coil voltage of the relays can be 5V or the input voltage, selectable by jumper. If SSR is to be controlled you do not need to use relays and instead can solder a wire bridge to switch the SSR to the drive transistors of the relays)
  • Status LEDs for the relays, power transistors and alarm output of the DS3231
  • Additional connections for I2C and ICSP
  • EEPROM can be write protected via jumper



I originally designed this circuit to control my aquarium. The circuit can regulate the LED lighting via PWM with different lighting profiles. Furthermore, the temperature is controlled via relays and the CO2 system is switched. In addition, the water level is monitored and refilled with a small 12V pump if necessary. The sensor module contains a temperature sensor (DS18B20) which is cast in synthetic resin and a capacitive proximity sensor, which responds very well to the water surface.
However, I have not finished this project yet. I do not have a real idea for the case yet. It should not only be compact, but must also be overheating resistant and meet the necessary safety requirements for operation with 230V. Funny enough, I seem to need a lot more time for the case than for all the electronics. But that's exactly what I have not got at the moment because of my job. Not to mention that, for safety's sake, I have to take a multi-day test under supervision before I can run it self-sufficiently. And finally, the software is not finished yet. 95% of the MCU memory is already used up and I have to find optimization potential. ... That also led to the development of my "MightyNanoS", which can also be found on this blog. 

What works so far you can see in this video, but I did not connect the sensor assembly for this.

But why am I releasing an unfinished project? The answer is that during development I took care to keep it as universal as possible. So it is not a dedicated controller for an aquarium, but can be used in many fields. Just the currently much acclaimed home automation offers itself here, to name just one example.

My KiCAD project files can be downloaded from my Google Drive:
Google Drive
KiBoard_V2.3.zip
Bytes: 3905564
MD5: EFF29FD6D84D87A90EEA18ED76B6FD8F
SHA256: 285607216C3D8941B064AD230EE128B87AC86C69B0982ED9B892F85C83F2A788

There is another archive in the ZIP files. This can be uploaded directly to a board manufacturer (I use Seedstudio or JLCPCB) to order professional PCBs in your desired color.
My project is free for private use. It is aimed at experienced people. I take no guarantee! Duplication is at your own risk and responsibility!
You are welcome to customize or modify my project and publish it. However, you always have to refer to the origin!