Dual Relay Board Using SMD Components

Dual channel Compact  Relay driver module can be controlled by feeding 2-12V trigger voltage, Very useful project for application like Micro-Controller based projects, Remote controller, Lamp on Off, and any circuits which required isolated 5A current and high voltage switching by applying any TTL or CMOS level voltage. Two LED works as operation indicator, 3 pins screw terminals to connect load.  Relay provides both normally open and normally closed switching.

Note: Board is made only for low voltage switching applications.

Specifications

  • Input: 12 VDC @ 84 mA
  • Output: Two SPDT relay
  • Relay specification: 5 A @ 60 VAC
  • Trigger level: 2 to 12 VDC
  • Header connector for connecting power and trigger voltage
  • LED on each channel indicates relay status
  • Power Battery Terminal (PBT) for easy relay output connection

Dual Relay Board Using SMD Components – [Link]

RELATED POSTS

IdIoTware SD Card Temperature Logger

In this tutorial at hackster.io you will learn how to log data from LM35 temperature sensor values to an SD card and store it as CSV file.

In order to build this project you need the following parts:

  1. Arduino UNO
  2. idIoTware Shield
  3. USB-A to B Cable
  4. SD Card (up to 8GB)
  5. 2x Generic Jumper (0.1″)

 

The Idiotware Shield is a learning platform that offers both novices and advanced Arduino users
the opportunity to bring hundreds of projects to life quickly. it offers a large variety of wireless communication options, input sensors, outputs, storage and device extensibility.

 

The idIoTware shield has a built in lm35 sensor that has a sensitivity of 10mV / oC, that means according to this equation: Temperature ( oC) = Vout * (100 oC/V)

That if Vout is 0.5V , then, Temperature = 50 oC. However, this built-in sensor gives a higher analog voltage on pin A0 if a higher temperature was applied.

To set up the IdIoTware shield you need to connect  LM35 sensor to SEL0 3 pin header by using a jumper. The SD card should be connected to D6 and SD pin header, thus we need antoher jumper to enable it.
By uploading this code to your Arduino, you will create a CSV file with every one minute for 15 minutes. The temperature will be logged to the file thanks to the SdFat library used. You can edit the rate and duration as you prefer.

/* 
 The circuit:
 * LM35 sensor on analog pin A3
 * SD card attached to SPI bus as follows:
 ** MOSI - pin 11
 ** MISO - pin 12
 ** CLK - pin 13
 ** CS - pin 4
 */

#include <SPI.h>
#include <SdFat.h>
SdFat sd;
const uint8_t chipSelect = 6;

//const int chipSelect = 4;   //cs pin of SD card shield
int tempPin = A3;      // LM 35 is connected to A3 pin.
int buzzerPin = A2;    // buzzer is connected to A2 pin

File dataFile;   // the logging file
char filename[] = "Temp000.CSV";
float tempInCelcius;
float tempInFarenheit;
unsigned long time=0;
int samplingTime = 10;  //this variable is interval(in Seconds) at which you want to log the data to SD card.
int duration = 15;     //this variable is duration(in Minutes) which is the total time for which you want to log data.


void setup() 
    {
      // Open serial communications and wait for port to open:
      Serial.begin(9600);
      while (!Serial)
          {
            ; // wait for serial port to connect. Needed for native USB port only
          }

      Serial.print("Initializing SD card...");

     // see if the card is present and can be initialized:
     if (!sd.begin(chipSelect))  
        { sd.initErrorHalt();
          Serial.println("Card failed, or not present");
          // don't do anything more:
          return;
        }
     Serial.println("card initialized.");

     // create a new file
     for(unsigned int i = 0; i < 1000; i++) 
        {
          filename[4] = i/100 + '0';
          filename[5] = ((i%100)/10) + '0';
          filename[6] = i%10 + '0';
          if(! sd.exists(filename)) 
            {
              // only open a new file if it doesn't exist
              dataFile = sd.open(filename, FILE_WRITE);
              break;  // leave the loop!
            }
        }

      if(! dataFile) 
        { //alert user
          Serial.println("couldnt create file");
          int alertAlarm1[] = { 1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,
                           1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,};
          int noteDurations[] = { 5,5,5,5,5,5,5,5,5,5,5,
                                  5,5,5,5,5,5,5,5,5,5,5 };
          for (int thisNote = 0; thisNote < 20; thisNote++) 
             {
               // Duration = 1 second / note type
               // e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
               int noteDuration = 2500 / noteDurations[thisNote];
               tone(A2,alertAlarm1[thisNote], noteDuration);
               //pause for the note's duration plus 100 ms:
               delay(noteDuration + 100);
             }
        }

     Serial.print("Logging to: ");
     Serial.println(filename);
     
     dataFile = sd.open(filename, FILE_WRITE);
     // if the file is available, write to it:
     if (dataFile) 
       { 
         dataFile.print("Logging Temperature for ");
         dataFile.print(duration);
         dataFile.print(" minutes at interval of ");
         dataFile.print(samplingTime);
         dataFile.println(" seconds.");
         
         dataFile.close();
       }
      // check availble space on SD Card
      uint32_t freeKB = sd.vol()->freeClusterCount();
      freeKB *= sd.vol()->blocksPerCluster()/2;
      Serial.print("Free space KB: ");
      Serial.println(freeKB);
      uint32_t freeMB= freeKB/1024;
      Serial.print("Free space in MB: ");
      Serial.println(freeMB); 
      
      if(freeKB <= 500)
        {
          Serial.println("LOW SPACE!!!");
          int alertAlarm2[] = { 1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,
                               1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000};
          int noteDurations[] = { 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
                                  15,15,15,15,15,15,15,15,15,15,15,15,15,15,15  };
          for (int thisNote = 0; thisNote < 20; thisNote++) 
             {
               // Duration = 1 second / note type
               // e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
               int noteDuration = 2500 / noteDurations[thisNote];
               tone(A2,alertAlarm2[thisNote], noteDuration);
               //pause for the note's duration plus 50 ms:
               delay(noteDuration + 50);
             }
        }
     duration *= 60;   //convert durartion in minutes to seconds   
   }

void loop() 
    {
      dataSamples();    // here we are logging data at interval of 1 minute for 15 mintutes, i.e, 15 samples.
                            // if you want to save data for 2 hours then simply multiply 2 by 60 which will give 
                            // you value of 120 minutes then use 120 as second parameter.
    }

// this method will log data to SD card at particular interval and for paricular duration
int dataSamples()
   { 
     // here we are logging data at interval of 1 minute for 15 mintutes, i.e, 15 samples.
     // if you want to save data for 2 hours then simply multiply 2 by 60 which will give 
     // you value of 120 minutes then change the varible duration to 120. 

      tempInCelcius = ( 5.0 * analogRead(tempPin) * 100.0) / 1024.0;
      
      // uncomment following line to get temperature values in Farehniet
      //tempInFarenheit = ((tempC*9)/5) + 32;            //convert celcius to farenheit
      
      unsigned long  elapsedTime = millis()/1000;   // this variable will keep track of elapsed time
      while(((millis()/1000)-elapsedTime) < 1);    // this loop will do nothing until a second has passed 
      time++;                                       //increment time after each second.
 
      if((duration >= time) && (time % samplingTime == 0))
        {
          LogToSDcard();  //Log to SD using commands under void LogToSD()  
          // print to the serial port too:              
          Serial.print("Temperature: ");
          Serial.print(tempInCelcius);
          Serial.print(char(176)); 
          Serial.println("C");     
        }
           
   }
   
void LogToSDcard()
   {
     // open the file. note that only one file can be open at a time,
     // so you have to close this one before opening another.
     dataFile = sd.open(filename, FILE_WRITE);
     // if the file is available, write to it:
     if (dataFile) 
       { 
         dataFile.print(tempInCelcius);   
         dataFile.println("°C");
         dataFile.println(",");
         dataFile.close();
         
     // to print temperature values in Farehniet uncomment following code.    
         
      /*  dataFile.print(tempInFarenheit);
         dataFile.print("°C");
         dataFile.println(",");
         dataFile.close();   */
       } 
  
      //if the file isn't open, pop up an error:
     else 
        {
          Serial.println("error opening datalog.txt");
          delay(2000);
        }
   }   
 

As soon you get the CSV file copied from the SD card, you can visualize the data in graphs.

This video by IdIoTware team demonstrates how to build this project in details, check it out:

You can check the project’s page for more information and detailed tutorial.

 

Raspberry Pi LCD Touchscreen Calibration

Circuit Basics @ youtube writes:

In this video, I go through the process of calibrating an LCD touchscreen on the Raspberry Pi. Calibrating the LCD touchscreen should be done after installing it to make it more responsive and accurate.

Raspberry Pi LCD Touchscreen Calibration [Link]

2X L298 Dual DC Motor Driver Board for Robots

2x L298 H-Bridge Dual Motor driver project can control two DC motors connected to it.  The circuit is designed around popular dual H-Bridge L298 from ST. Motor supply 7V To 46V DC, Load 2Amp Each Channel.

Features

  • Motor supply V2: 7 to 46 VDC
  • Logic Supply V1 : 5V DC
  • Input Signal: Enable, Dir. , PWM
  • Board Provides Current Feed Back ( On Board Shunt Resistor)
  • Control Logic Input: Standard TTL logic level
  • Output DC drive to motor: up to 2A + 2A
  • External Diode Bridge for protection
  • On Board 5V Power LED
  • On Board Motor Supply LED
  • 10X Box Header Connector for Inputs and PWM
  • Header Connector For Logic Supply
  • Screw Terminal for Motor Connections
  • Screw Terminal For Motor Supply

2X L298 Dual DC Motor Driver Board for Robots – [Link]

Weather Widget using ESP8266

deba168‘s new instructable is a weather widget: “an application that can be downloaded on your PC, laptop or a mobile device and perform the job of providing easy access to weather information”

It’s an ESP8266 based weather display unit which retrieves localized weather information from http://www.wunderground.com by WLAN and displays it on a 128×64 OLED display. It displays the current time with date, some weather information like temperature, pressure, humidity and rainfall, and finally the forecasting for the next 3 days.

Check this demo video:

In order to build this project you need the following parts:

  1. ESP8266 -01 (eBay )
  2. Optional NodeMCU ESP8266-12 ( eBay )
  3. OLED Display (eBay )
  4. Voltage Regulator AMS1117 ( eBay )
  5. Tactile Switch (eBay )
  6. Slide Switch ( eBay )
  7. Resistors ( 10K and 330R )
  8. Female Double Row Straight Pin Header ( eBay )
  9. Male Double Row Right Angle Pin Header ( eBay )
  10. Jumper Wires ( eBay )
  11. Prototype Board ( eBay )

You can build the circuit as per the design below on a  prototype board or a PCB:

 

For programming you have to use these files:

Arduino Code: ESP8266 Weather Station

Libraries : Json Streaming Parser, ESP8266 Oled Driver for SSD1306 display

The project’s maker advises you to follow his steps in the code inside this zip file to avoid any problems in compiling.

For obtaining data from the Weather Underground , you need to get an API key through signing up in the website and purchasing one. Once you clarify that you won’t use it for commercial use, you won’t be asked for any pay methods.

To make sure that the code will work correctly, you have to change the following things.

  1. Enter the Wunderground API Key
  2. Enter your Wifi credentials
  3. Adjust the location according to Wunderground API
  4. Adjust UTC offset

The final step will be programming the ESP8266 module using FTDI programmer.

Check this video for more information and to see the project in action:

 

You can check the instructable page for more information and detailed tutorial.

New PWM controller IC By Microchip Charges Batteries of Any Chemistry

Battery technologies of all chemistry are experiencing revolutionary changes nowadays. Nanotechnology is leading this revolution by yielding new battery technologies including but not limited to Tiny Supercapacitors and Li-ion batteries that never explode at any condition. But, it’s bothersome to make different chargers for different types of batteries. So, Microchip solved this problem by introducing a new hybrid PWM controller, MCP19124/5, that charges batteries of any chemistry.

MCP19124 PWM Controller - 24 Pin QFN Package
MCP19124 PWM Controller – 24 Pin QFN Package

The power of this charging device lies in the combination of an 8-bit PIC microcontroller and an analog PWM controller in one package. This mixed signal low-side PWM controller features individual analog PWM control loops for both current regulation and voltage regulation. It can be configured with separate feedback networks and reference voltages. Any voltage, current, temperature, or duration can be used to trigger a transition to a different charging profile.

Various types of batteries require different charging profile. So, the only way to charge all kinds of batteries with a single device is to simulate all the charging profiles. A user can set his/her desired profile with the help of two independent current and voltage control loops, along with variable reference voltage. Now let’s get to know more details about this versatile PWM controller IC.

MCP19124/5 : 

The MCP19124/5 is a mid-voltage (4.5-42V) analog-based PWM controller with an integrated 8-bit PIC Microcontroller. There are two devices, the MCP19124 and MCP19125, where the last one has four I/O pins more than the first one. MPC19124 and MPC19125 are packaged in 24-lead QFN package and 28-lead QFN package respectively. It has following features:

  • Smooth, dynamic transitions from constant-current to constant-voltage operation
  • Dynamically adjustable output current and output voltage over a wide operating range
  • Wide operating voltage range: 4.5-42V
  • Analog peak-current mode Pulse-Width Modulation (PWM) control
  • Available fixed frequency (31 kHz to 2 MHz)
  • I2C communication interface
  • 9 GPIO for MCP 19124 and 12 GPIO for MCP19125
  • Integrated high voltage linear regulator, with external output
  • Integrated temperatures sense diode
  • Integrated 10 bit A/D converter
  • Minimal external components needed
  • Custom algorithm support
  • Topologies supported include Boost, SEPIC, Flyback, and Cuk

In fact, the above list is just a brief overview. The controller is so complicated that user must read all 236 pages of the datasheet to gain sufficient knowledge.

Now, the question is, how can we use this IC to design an efficient battery charger?

To find the answer, one must read the datasheet thoroughly. At the same time, in-depth knowledge about the target battery is also required. However, Microchip provided a few schematics (as references) in the datasheet based on different applications. The circuit on battery charger is given below:

Battery Charger Circuit Using MCP19124 ICBattery Charger Circuit Using MCP19124 IC
Battery Charger Circuit Using MCP19124 IC

This ultimate powerful dual-loop PWM controller is going to be a game changer and part of the battery technology revolution. It possesses lots of possibilities. To learn more about this fantastic hybrid controller, study the datasheet carefully.

Ultrasonic parking sensor

An ultrasonic parking sensor project from Ch00ftech:

After electing to use the PING))) sensor exactly as directed, I needed to build the rest of my circuit.  I wanted to build something robust that would mount nicely on the wall of my dad’s garage.  Figuring that the sensor would likely need to be placed down low by the car’s bumper, I decided on a two-component design consisting of a small sensor and a large visible display that could be mounted at eye-level.

Ultrasonic parking sensor – [Link]

PNP Transistor – How Does It Work?

The PNP transistor is a mystery to many. But it doesn’t have to be. If you want to design circuits with transistors, it’s really worth knowing about this type of transistor. by Oyvind @ build-electronic-circuits.com

PNP Transistor – How Does It Work? – [Link]

MKRZero, Arduino Newest Family Member

Arduino had announced a new member of its family: MKRZero! This new board comes with the size of 61x25mm MKR1000 board and the power of ARM-core Arduino Zero.

The ARM-core board consists of an on-board SD connector with dedicated SPI interfaces (SPI1) that make it easy to browse your files with no extra hardware.

You can power your MKRZero using a micro-USB cable or a LiPo battery, but you should pay attention that the operation voltage is 3.3.V and applying higher voltages to any I/O pin will ruin the board. To guarantee the voltage, you can use a battery and monitor it using analog converter.

The small size, low power consumption, integrated battery management, and integrated SD management are some of the advantages of this great tiny board.

MKRZero has 22 digital I/O pins, 12x PWM, 1x UART, 1x SPI, 1x I2C,32x LED_BUILTIN, 7x analog input pins, 1x analog output and 8x external interrupts. Here are the hardware specifications:

  • Microcontroller: SAMD21 Cortex-M0+ 32bit low power ARM MCU
  • Board Power Supply (USB/VIN): 5V
  • Supported Battery: Li-Po single cell, 3.7V, 700mAh minimum
  • DC Current for 3.3V Pin: 600mA
  • DC Current for 5V Pin: 600mA
  • Circuit Operating Voltage: 3.3V
  • DC Current per I/O Pin: 7 mA
  • Flash Memory: 256 KB
  • Flash Memory for Bootloader: 8 KB
  • SRAM: 32 KB
  • Clock Speed: 32.768 kHz (RTC), 48 MHz

If you program your boards using Arduino Web Editor then everything is set. But to program MKRZero using Arduino IDE, you need to update the IDE by adding the new Intel SAMD Core by selecting Tools> Boards Manager as shown in the picture.

Due to its small size, MKRZero is said to be the best fit for your next innovative projects in wearable technology, high-tech automation, robotics, and much more. Some tutorials for projects using MKRZero are available now on Arduino project hub.

You can purchase the board for $22 from here. You can learn more about MKRZero at the announcement, product page, and the guide.

DICE10 – A miniaturized electronic die based on ATtiny10

Making an electronic dice is very popular among hobbyists and there are already lots of ready-made projects on the internet about this topic. Tim at Hackaday.io designed an electronic dice project for “1KB Limit” competition. But why another dice project while the internet is already crowded with similar things?

Well, it’s not the subject of this project, but the concept, which makes it unique. This is the most miniaturized dice one can make. As Tim says:

It makes use of a very efficient multiplexing scheme to drive all the 7 LEDs of an electronic die with only two I/O pins.

Yes, you’ve read it right. Only two I/Os are used to control all 7 LEDs of a die. It became possible for a super-efficient multiplexing scheme – Charlieplex Plus. The main goal of this project is introducing you to Charlieplex Plus.

DICE10 - The Tiny Electronic Die
DICE10 – The Tiny Electronic Die

Requirements:

  • 1 x ATtiny10
  • 7 x SMD LED 0603
  • 1 x SMD Capacitor 100n 0805
  • PCB of the Circuit

Please Note: SMD components are used to miniaturize the circuit. You can easily go for through-hole components if size is not a concern.

Important Links:

Circuit and PCB:

Circuit Diagram of DICE10
Circuit Diagram of DICE10

You can see from the circuit that connections are pretty straight forward. PB2 and PB0 are used to drive the LEDs. The remaining free I/O pin, PB1, is used as a touch sensor. PB1 is RESET pin, so it can’t be used as GPIO.

All components are squeezed into a PCB that is only 13 mm x 19 mm. Instead of 6 pin headers, edge connections are used for SPI/TPI interface in order to reduce the PCB size.

PCB Diagram Of DICE10
PCB Diagram Of DICE10

Design:

As an entry for Hackaday 1Kb competition, one vital target of this project was to keep the code size below 1Kb. Using an ATtiny10 as an MCU automatically limits the code size to 1kb, so the requirement is automatically met.

The firmware uses a timer interrupt to multiplex all the 7 LEDs. The main routine calls the TinyTouchLib to poll the touch button. If a button press is detected, the value of the die is changed in a random manner. Though due to smaller physical size, the touch button is somewhat unreliable and often detects multiple touches. But there is no problem in using it as a random number generator.

Multiplexing:

Now coming to the most interesting part of the design – the multiplexing scheme. A very common and efficient scheme is Charlieplexing. Impleneting charlieplexing you can control n²-n LEDs by n I/O lines.

Now, how can you control 7 LEDs of the die using only 2 I/O pins?

The dice pattern consists of 7 LEDs. However, you will quickly notice that 6 of these LEDs only light up in pairs, so that only 3 pairs of LEDs plus the middle one need to be controlled. This requires four I/Os – still too much!

Using Charlieplexing we can reduce the number of I/O lines to three. but still a bit too much for the ATtiny10, as an extra I/O line is required to “roll the die”. The only solution left is “Charlieplex Plus”. Before explaining that, let’s learn what Charlieplexing is.

Charlieplexing: Charlieplexing is a technique for driving a multiplexed display in which relatively few I/O pins on a microcontroller are used to drive an array of LEDs. Charlieplexing uses the tri-state property (neither HIGH nor LOW state) of microcontroller I/O pins. Only two I/Os are active at a time – one set to HIGH and one set to LOW – while all other pins are in a high resistivity state. LED connected between two active I/Os will light up.

Now, what if we activate only one I/O instead of two? Here comes Charlieplex Plus.

Charlieplex Plus:

Charlieplex Plus Circuit Example
Charlieplex Plus Circuit Example

The circuit above shows how to connect LEDs in this scheme. In addition to the antiparallel pair between the two I/O pins (PB2 and PB0), LEDs are also connected to VCC and GND. The sum of forward voltages of the four LEDs in series (LED1-4 and LED5-8) is higher than 5V so that they will not light up when PB0 and PB2 are in the high impedance (Z) state.

When either PB0 or PB2 is H or L and all other pins are Z, sufficient voltage is present to light up a pair of LEDs. However, when PB0 is HIGH and PB2 is LOW or vice versa, LED9 or LED10 will light up.

In fact, Charlieplex plus scheme is really hard to understand. It is impractical as well. But it’s still usable in such cases where our only option is to control lots of LEDs with lesser I/Os. Let’s look at the table to have a better understanding:

Charlieplex Plus Encoding Table
Charlieplex Plus Encoding Table

A general analysis shows that the new scheme can drive n²+n LEDs with n I/Os. The table below shows the number of LEDs than can be driven with a given number of I/Os with different multiplexing schemes.

Table of Comparison Between Different Multiplexing Schemes
Table of Comparison Between Different Multiplexing Schemes

So, in a summary, we can see that two I/Os are capable of handling three LEDs, and that’s what we need.

Conclusion:

In this article, the multiplexing scheme was the first priority. If you understand the scheme clearly, you can implement it in different projects. Read this blog post if you are willing to learn more on this.

This image shows how the DICE10 works:

Animated Image of DICE10
Animated Image of DICE10

But remember that implementing Charlieplex Plus in any project is not recommended at all. It’ll make the design and the troubleshooting process extremely complex.