Saturday, October 29, 2016

Micro stepdown Buck converter

Fun project, pretty close to reaching my PCB making capabilities in terms of track size and clearances. Also testing my new built PCB drill which was posted earlier.
The brain of this project is the XL4001 IC which minimizes external components and provide excellent voltage regulation and current protection. Input voltage range is from 4.5V to 40V and output current up to 2A. Switching frequency is around 150khz+-25Khz for regulation. 
The schematic follows the basic application circuit from data sheet, with minor changes to allow an adjustable output voltage.
The current protection is defined by value of RS as follow
Iout=0.155/RS
On the board shown, used a 0.3ohm resistor to set Iout max at about 500mA.
As seen, the schematic calls for a 4pin header connector while the board shown has only 3 pins. Since the ground for the load must be isolated from common ground of input power (isolated by RS), two pins input and 2 pins output are required. The shown board will need a layout correction.
Anyways, tested with 20Vdc input,  output adjustable from 3.3v to 18.5V. However, the max output voltage should not exceed input-3V(input-1.5v as per datasheet).
I also used this same IC for a constant current LED driver with very good results, to be posted in the future.











Sunday, October 16, 2016

Step Motor driver Allegro A3977

Running some tests on the A3977 step driver IC, schematic below. Have not been able to make it work yet, if ideas out there please chime in with comments.
Note that some resistors are 00(zero)ohms, used as jumpers since I didn't want to make via on this board (yet developing the drill press).






PCB drill press

Building a PCB drill out of a 12mm linear rail and other material sitting around. Thought of making the big jump to a complete CNC machine, but keeping budget lower for now.
The rails are 12mm diameter with two pillow blocks, the must have parts to achieve some level of precision, specially when making PCB's down to 10mils sizes.
The motor used for the drill is an old DC motor from a cordless drill that operates with around 2.A and the motor driving the slide was purchased from eBay. All is working out of a 12V regulated power supply.
The control circuit is as simple as it can gets, just a position switch to detect and stop the slide at idle position, a foot switch to trigger the drill and few components to provide lower speed on the drill motor while in idle state.
The slide is weight balance by both spring and counter weight system and target selection done with a camera and two mirrors made of a HD current in half.
Below some pics and video.





























Wednesday, September 28, 2016

PCB making

Like most electronic enthusiast, sooner or later you end up with the challenge to build your own circuit boards, from very simple to quite complicated multi-face smd designs, Sharing my experience with making PCBs, past experiences, current known processes (that I'm aware of), and current developments I'm working on.
Assuming one knows already what a pcb is and why you need one, here's some basic on processes that I have used with highlights of benefits and issues. Some of these I know exist out there and I have not tried.



Any questions or comments are welcome thru comments.

Thru-hole copper plating

Spending some time looking for a more effective way to copper plate two sided PCB boards, combining ideas from different sources.
Currently, as far as I can find on shared media, the whole surface of the copper sheet, on both sides, are plated in order to actually achieve the objective of plating the holes.
This seemed to be a waste of time, and overall cost of raw materials. So envisioning here a system that utilize the very known film resist technology to isolate most of the copper, allowing quick and cheap plating of pads and holes.
I'm also trying to replicate some recipes found online for the hole activation solution, which in my opinion is the most critical element of this process. Still collecting chemicals, some not easy to get in US due to DEA restrictions, will post the recipe once tested.

Below is the design for the plating tank, which consist of a acrylic box, with middle flanges to hold the PCB like a sandwich, isolating top and bottom plating solution, allowing flow thru the holes only.
The board is drilled and receive a film resist layer that allow pads and vias to be exposed. This can easily be achieved with common PCB design CAD SW's, like Eagle.
The copper layer in both top and bottom layers of the board are electrically connected to the negative of the plating power source.
Two copper mashes are positioned above and below the PCB and both connected to the positive of the power source, allowing even plating of the pads, vias and holes from both sides.
Another element is the fluid pump that will circulate the plating solution, moving it from top to bottom of the tank. The main objective of this is to force solution into the holes, bottom to top, allowing better plating and push out  and release bubbles that form inside the tiny holes.

Right now this is just a project, will post as it develops. Any thoughts and feedback are welcome.






  

Friday, April 22, 2016

Attiny85 Timer part2

Here's the updated project that includes a 4 digit display module, alarm sound, ON LED and power supply.
Note that Attiny85 is set to 8Mhz clock. Programming was done using an Arduino Micro operating as ISP. Will share about the programming board, issues and how to program the Attiny85 in another post.
Due to limited I/O pins on Attiny85, had to utilize some tricks to expand its capability by using the analog input for time adjust also as a digital input. This is achieved by limiting the lower end voltage selected by the potentiometer to about half of vcc, so about 2.5V. So when turned all the way in one direction, analog input will read minimum of 2.5V ( zero seconds timer) and on the other direction 5V (240 seconds timer). Same input will be close to 0V when the start button is pressed, providing the digital check for the start function. In fact, this process can be expanded by subdividing the VCC into smaller buckets, but not required for this project.

Schematics:
Board:

Will post a video of working timer one board is assembled.


Click here for Eagle and Arduino code files
Arduino display library found in GitHub here. This is a simple library that actually works. I have spent a whole lot of time searching and testing other libraries.

Here's how it operates:
1-Time in seconds is displayed , adjustable by the potentiometer. Range is software defined, example code range is 0 to 240s.
2- After time is adjusted, one quick press (1/2 sec) on the start button will initiate the countdown, relay is commanded, LED will light and time left is displayed until it reaches zero.
3- When count down is completed, relay will release as well as LED will turn OFF. Adjusted time will now be displayed and we are basically back to step 1
4- If start button is pressed again after countdown started, timer will reset and goes back to step1
5- A short beep is added on every touch of the start button and an intermittent alarm will sound at end of countdown. Pressing the start button when alarm is on-going will stop it.

Arduino code is below, also found on the provided link.

#include <TM1637Display.h> //library for display module
#include <elapsedMillis.h> // library for timing

elapsedMillis timer=0; // set timer variable
int timer2=0;
int p=0;
TM1637Display display(2, 0); //defines logic pins which display module is connected in attiny, display(CLK=2,DIO=0)
byte data[] = {0, 0, 0, 0};  // variable array that define values of display digits

void setup() {
pinMode(A3,INPUT);//attiny85 pin 2/PB3/A3
pinMode(1,OUTPUT);//attiny85 pin 6/PB1/D1 output relay
pinMode(0,OUTPUT);//attiny85 pin 5/PB0/D0 display data
pinMode(2,OUTPUT);//attiny85 pin 7/PB2/D2 display clk
pinMode(4,OUTPUT);//attiny85 pin 3/PB4/D4 output buzz
digitalWrite(1,LOW); // initiate relay off
digitalWrite(4,LOW); // initiate buzz off
timer=0;
 display.setBrightness(0x0f); // set display brightness to max
}



void loop() {
int8_t TimeDisp[] = {0x00,0x00,0x00,0x00};
int x=0;
if(analogRead(A3)>200 &&digitalRead(1)==LOW ){ // check if start is released. When start is pressed, voltage at pin A3 is close to 0V, otherwise it is defined by the potentiometer but limited to range around 2.5 to 5V

timer2=0;
for (x=1;x<=30;x++){ //number of times the A3 input is read to average input time
timer2=timer2+constrain(map(analogRead(A3),515,1023,0,240),0,240); // reads analog input A3, specify digital range of 515 to 1023 and map to variable from 0 to 240 seconds

}
timer2=timer2/30; //calculate average
}
if (analogRead(A3)<100){//Check if start is pressed. A3 will be close to 0V if pressed.
p=1; // variable to indicate timer is in active mode

digitalWrite(4,HIGH);// short beed
delay(100);
digitalWrite(4,LOW);
delay(100);
}

if(digitalRead(1)==HIGH) //verify if relay output is activated for display mode selection
{
//next 6 commands display the time left for countdown mode
data[0] = display.encodeDigit((timer2-timer/1000) / 1000 % 10);
data[1]= display.encodeDigit((timer2-timer/1000) / 100 % 10);
data[2] =  display.encodeDigit((timer2-timer/1000) / 10 % 10);
data[3] =  display.encodeDigit((timer2-timer/1000) % 10);
display.setSegments(data);  // muestra la variable byte data
delay(100);

}
else
{
//next 6 commands display de setup time, vary with potentiomenter position
data[0] = display.encodeDigit((timer2) / 1000 % 10);
data[1]= display.encodeDigit((timer2) / 100 % 10);
data[2] =  display.encodeDigit((timer2) / 10 % 10);
data[3] =  display.encodeDigit((timer2)/1 % 10);
display.setSegments(data);  // muestra la variable byte data
delay(100);
}

if (p==1){//check if current timer state is activated
if (analogRead(A3)>200){//check if start button is released
digitalWrite(1,!digitalRead(1)); // invert state of relay output when button is pressed. If previsouly active, set it to LOW, if previously OFF, set it to HIGH.
timer=0;
p=0;
delay(500); //timer to wait to avoid long press of button to be interpreted as mutiple pushes
}//C
}//D
if ((timer/1000)>timer2 && digitalRead(1)==HIGH ){//G countdown finished when in active mode
digitalWrite(1,LOW);// release relay
  for (x=0;x<=20;x++){ // loop to beep alarm for 20 times
if (analogRead(A3)<100){ // check if start is pressed to interrupt alarm beeping
x=21;//set variable to end value to exit loop
delay(100);

}
digitalWrite(4,HIGH); // alarm beep
delay(100);//define interval of alarme beeps on
if (analogRead(A3)<100){// check if start is pressed to interrupt alarm beeping
x=21; //set variable to end value to exit loop
delay(100);

}
digitalWrite(4,LOW);
delay(100);//define interval of alarme beeps off
if (analogRead(A3)<100){// check if start is pressed to interrupt alarm beeping
x=21;//set variable to end value to exit loop
delay(100);

}
}

}//G
}

Tuesday, April 5, 2016

Attiny85 timer

First post here!
Building a timer for my UV light PCB making apparatus. Posting now the code for Arduino Micro. Using 6250 bytes of memory, so should have no issues to load this to Attiny85 with required pin designation changes. This code uses same analog input to both read the time setting from a regular potentiometer as well as the input for the start/stop button. This maximizes the IC limited I/O pins. The Serial Print commands are not required and my updated code will include instead a serial print to a 4 digit display module (SCL and SDA lines) to show the actual time set and count down information.
I'll be posting the updated code for Attiny85 pinout and schematic. The code allows a time adjust from 0 to 240 seconds, but can be expanded with a simple code change.
Yes, complete overkill to use a micro controller for a simple timer, just trying to learn Arduino coding by building basic projects. Plus, Attiny85 are very cheap these days!

Here's the code for now.

#include <elapsedMillis.h>

elapsedMillis timer=0;
int timer2=0;
int p=0;
void setup() {
pinMode(A0,INPUT);
pinMode(13,OUTPUT);
Serial.begin(9600);
digitalWrite(13,LOW);
Serial.begin(9600);
timer=0;
}
void loop() {
if(analogRead(A0)>200){
timer2=constrain(map(analogRead(A0),515,1023,0,240),0,240);
}
if (analogRead(A0)<100){//C
p=1;
delay(100);
}
if(digitalRead(13)==HIGH)
{
Serial.print("timeleft=");
Serial.println(timer2-timer/1000);
delay(100);
}
else
{
Serial.print("time=");
Serial.println(timer2);
delay(100);
}
if (p==1){//D
if (analogRead(A0)>200){//C
digitalWrite(13,!digitalRead(13));
timer=0;
p=0;
delay(500);
}//C
}//D
if ((timer/1000)>timer2 ){//G
digitalWrite(13,LOW);
}//G
}

Here's the schematic in Eagle: