Tuesday, December 22, 2020

How to Setup and Change the System Clock on the SAMD21 Microcontroller Family

In this video we look at how to setup and change the system clock on the SAMD21 family of microcontrollers from Microchip / Atmel. This example code is written in C++ and uses direct register access.




Where to access the two versions of the code



Sunday, November 29, 2020

How to Design 24VAC to DC Power Supply for HVAC Applications Part 2

In the video we look at how to design a 24VAC power supply for industrial and HVAC applications. The supply will be flexible enough to handle DC voltage inputs. The power supply will employ a DC to DC buck converter, half wave rectifier, input protection against over voltage, and output noise reduction circuit features. In part 2 we look at the PCB design, the finished product, and capture some test data to see how it is working.




Monday, November 16, 2020

How to Design a 24VAC to DC Power Supply for HVAC Applications Part 1

 In the video we look at how to design a 24VAC power supply for industrial and HVAC applications. The supply will be flexible enough to handle DC voltage inputs. The power supply will employ a DC to DC buck converter, half wave rectifier, input protection against over voltage, and output noise reduction circuit features



Link to the ferrite bead article mentioned in the video: https://www.analog.com/en/analog-dialogue/articles/ferrite-beads-demystified.html# Link to TI Webbench Power Designer tool: https://webench.ti.com/power-designer/switching-regulator




Monday, December 9, 2019

Designing an Automatic Battery Cutoff Circuit to Prevent Over Discharge of Rechargeable Batteries Part 2

In this video we will design an automatic battery cutoff circuit to prevent damaging over discharge of rechargeable batteries. In part 2 we test the design and discuss MOSFET and Voltage Detector specs.




BOM of battery cutoff circuit: 
  • S-1011A70-M6T1U4 Voltage Detector from ABLIC
  • DMP4015SSS-13 P Chan MOSFET from Diodes Inc
  • BSS138 N Chan MOSFET from multiple manufacturers
  • RSX051VYM30FHTR Schottky Diode from ROHM Semi
  • 2x 3.3 nF Ceramic Capacitor
  • ~100 kOhm Resistor
  • 1 to 10 MOhm Resistor (used 4.7M in example circuit)

PCB Layout of Battery Cutoff Circuit

Friday, November 29, 2019

Designing an Automatic Battery Cutoff Circuit to Prevent Over Discharge of Rechargeable Batteries Part 1

In this video we will design an automatic battery cutoff circuit to prevent damaging over discharge of rechargeable batteries. To design our battery cutoff circuit we will use a Voltage Detector or Reset IC.


BOM from video:

  • S-1011A70-M6T1U4 Voltage Detector from ABLIC 
  • DMP4015SSS-13 P Chan MOSFET from Diodes Inc 
  • BSS138 N Chan MOSFET from multiple manufacturers 
  • RSX051VYM30FHTR Schottky Diode from ROHM Semi 
  • 2x 3.3 nF Ceramic Capacitor 
  • ~100 kOhm Resistor 
  • 1 to 10 MOhm Resistor

Battery Cutoff Circuit Schematic

Friday, May 31, 2019

Ways to Improve ADC Measurement Accuracy and Resolution Part 2

In part two of this 4 or 5 part series, we look at how the Successive Approximation or SAR ADC architecture works and understand its limitations. Note SAR based ADC architecture is what you typically find in microcontrollers.



To access the white paper that was referenced to derive the equation related to RC time constants and sampling time: https://www.silabs.com/documents/public/application-notes/AN119.pdf

Cutout from Silicon Labs App Note on calculating settling time for SAR ADC

Saturday, March 30, 2019

Ways to Improve ADC Measurement Accuracy and Resolution Part 1

In this video series we look at ways or tips to improve ADC measurement accuracy and resolution. In part 1 define what accuracy and resolution is and different types of error that can affect ADC measurements. We also look at the importance of using an accurate ADC reference voltage and why you want to scale the range of the signal you are measuring to the ADC's range.



//***************Arduino code used in video*******************************
/*This code demonstrates how to change the ADC voltage reference on an Arduino 
 * This was shown in an ADC tutorial on the ForceTronics YouTube Channel.
* This code is free and open for anybody to use at their own risk. 
*/

void setup() {
  Serial.begin(115200); //setup serial connection
  while(!Serial);
  analogReference(AR_EXTERNAL); //sets the ADC reference voltage to external (input is aRef pin)
  //analogReference(AR_DEFAULT); //set the ADC reference to default which is AVCC (uses power supply voltage or VCC as reference)
  //analogReference(AR_INTERNAL2V23); //uses 2.23V internal reference in SAMD21 uC
  analogReadResolution(12); //Set ADC to 12bit resolution, default is 10
  burn8Readings(); //make 8 readings but don't use them to ensure good reading after reference change
  delay(100);
  for(int i=0;i<500;i++) { //loop through a bunch of ADC readings and print them to serial plotter
    Serial.println(analogRead(A0)); //Make ADC measurement at A0
  }
  
}

void loop() {
  //don't need the loop
}

//This function makes 8 ADC measurements but does nothing with them
//Since after a reference change the ADC can return bad readings at first. This function is used to get rid of the first 
//8 readings to ensure an accurate one is displayed
void burn8Readings() {
  for(int i=0; i<8; i++) {
    analogRead(A0);
    delay(1);
  }
}