Study Neil's input boards → Decide what type of imput → Design Schematic/Boad → Mill the board→ solder components → debug → edit and publish website
Go to group assignment page
This week I will be testing a thermistor. Since I am building an incubator I will be needing to measure and control temperature.
The thermistor I chose is the B57560G0104, after reading its data-sheet I learned that at 25 degrees Celsius it has an resistance of 100K.
The way the thermistor works is by decreasing its resistance as the temperature increases. Because the IC on its ADC pin reads voltage not resistance we need to set a voltage divider in other to derive its resistance.
I will connect the Thermistor in series with the resistor that will be connected to VCC. One end of the thermistor will be connected to ground and the other that is in series.
As done on week 6 I started by reviewing Neil's boards. The one I would be redesigning is the visible light input board.
My objective with this experiment was to understand and test the thermistor and the code. I got it working but the temperature was not really accurate. Off course I am not using accurate instruments to calibrate the thermistor so I never know what is not correct so I ended up boiling water so I would know at least the temperature needed to be around 100 degrees Celsius.
Programer USBasp on a ATtiny45
In the video below I show the programming taking place.
Because I normally program with Arduino IDE it's quite useful to have not only the data-sheet but also a diagram that converts the pins from one programing platform to the other.
On a quick look we can determine that there are 4 Arduino analog pins. They all have a analog to digital converter (ADC0, ADC1 ADC2, ADC3), so they could also be used as digital pins together with pins 1, 0 and 2.
For this assignment I will need 1 analog pin and 2 digital pins. The analog pin I will connect the thermistor and the digital pins are for the serial communication.
The board will have a header for the ISP programmer, 2 headers in the sides so all pins can be used and tested as needed as well as a led just to show there is power coming in.
Autodesk Eagle is the weapon of choice. but I will be creating the G-code with pcb-gcode addin.
In order to calculate the resistor values, I examined the following Datasheets and the calculations/observations I made:
Bellow is how my schematics looks like:
On my thermistor board I used:
The way the a NTC thermistor works is as the temperature raises the resistance reduces and vice-versa, so we need to find out the resistance.
We will then have to use a resistor to help us calculate the voltage drop. The IC used the ATtiny45 doen't measure resistance so in order to calculate the resistance of the thermistor we'll have to use a known resistor and measure the voltage coming and calculate the voltage drop between the thermistor and the 100k resistor. The formula I used in the program is this: RT = ((VCC*R-R*VRT)/VRT)
I used 3 sets of code for this assignment.
#include "SoftwareSerial.h" SoftwareSerial Monitor(1, 0); void setup() { Monitor.begin(9600); pinMode(0, OUTPUT); pinMode(1, INPUT); }
also when you whant to print something you need to do it in a different way:
Monitor.println(whatever you what to print here);
The code I used for the experiments with Arduino I found on the Arduino's project hub How Easy Is It to Use a Thermistor?! authored by Marcazzan_M:
//Thermometer with thermistor /*thermistor parameters: * RT0: 10 000 Ω * B: 3977 K +- 0.75% * T0: 25 C * +- 5% */ //These values are in the datasheet #define RT0 10000 // Ω #define B 3977 // K //-------------------------------------- #define VCC 5 //Supply voltage #define R 10000 //R=10KΩ //Variables float RT, VR, ln, TX, T0, VRT; void setup() { Serial.begin(9600); T0 = 25 + 273.15; //Temperature T0 from datasheet, conversion from Celsius to kelvin } void loop() { VRT = analogRead(A0); //Acquisition analog value of VRT VRT = (5.00 / 1023.00) * VRT; //Conversion to voltage VR = VCC - VRT; RT = VRT / (VR / R); //Resistance of RT ln = log(RT / RT0); TX = (1 / ((ln / B) + (1 / T0))); //Temperature from thermistor TX = TX - 273.15; //Conversion to Celsius Serial.print("Temperature:"); Serial.print("\t"); Serial.print(TX); Serial.print("C\t\t"); Serial.print(TX + 273.15); //Conversion to Kelvin Serial.print("K\t\t"); Serial.print((TX * 1.8) + 32); //Conversion to Fahrenheit Serial.println("F"); delay(500); }
the code here
#include "SoftwareSerial.h" #define VCC 5 //Supply voltage #define R 100000 //R=100KΩ float RT,VRT,VR; SoftwareSerial Monitor(1, 0); void setup() { Monitor.begin(9600); pinMode(0, OUTPUT); pinMode(1, INPUT); } void loop() { VRT = analogRead(3); //Acquisition analog value of VRT VRT = (5.00 / 1023.00) * VRT; //Conversion to voltage VR = VCC - VRT; RT = ((VCC*R-R*VRT)/VRT); //Resistance of RT // Monitor.println("Voltage Read:"); // Monitor.print(VRT,10); // Monitor.println("Voltage drop:"); // Monitor.print(VR,10); Monitor.print("Resistance:"); Monitor.println(RT); delay(1000); }
Aso his formula of finding the resistance did not work for me I suspect it is because I use a NTC thermistor, so I had to modify the formula and it looks like this now:
RT = ((VCC*R-R*VRT)/VRT); //Resistance of RT
Since I modified my work-flow I decided to update it. Now It contains the usage of PCB-Gcode ULP and Autoleveller software usage.
With the schematics ready click on:
With the components placed next to the square that represents the board, the board will be resized later.
Typing "move" then "pressing enter" alows you to click on each component and drag it to insid the board.
Here I started dragging the attiny45 inside the board limits. Again, clicking each component won't require typing "move" again, unless "esc" is pressed or another command.
Here all components are dragged and the superior limits are being dragged and resized with the command "move" ass well. Another way of moving components is typing "info" and then left clicking the component, this will allow typing the coordinates of the element instead of dragging.
The command "rotate" will alow you to turn the component to the ideal orientation routing the wires is more eficient. The yellow lines represent the connections created in the schematics part.
Here I am creating a contour with the command polygon, when its closed it will open a dialog box.
After the polygon is finished the dialog will open typing "GND" connects the polygon to ground.
Typing ratsnest of clicking its icon will fill up the hole board area with the ground layer so now either by typing autoroute or the net command the components can be connected.
Now before routing the components go to edit --> design rules and there the distances between each element can be defined.
In the tab sizes define the minimum with of wire. On my experience 0.2mm works great.
The tab clearance sets the distance between each element of the pcb I am sing currently 0.3mm on all Signals.
Now with all design rules set typing autorouter or clicking its icon will start the process of connecting each component.
An important setting is clicking on the dialog box labeled bottom and selecting N/A if not desired two sides. Then pressing willl start the process.
Next chose one of the option and then click on evaluate or end job in order to go back to the board layout.
I circled in yellow to show the bottom layer of the board in blue. I do not want this so I will reset the board in the next step.
Here you can see the effect of the command "ratsnest". This command will basically fill up all the spaces not occupied by a via with the ground element.
Because I want autorouter do it over I typed "ripup" and then I selected all so all routes are undone.
And redo the autoroute process.
Here the route is done but not yet with ratsnet.
Here ratsnest is applied.
In here I moved the components around in oder to shrink the board a bit. This is basically done with the command "move" If you what to move numerous components select them and type group then type "move"and right click them to move the hole group.
Bellow you can see a board with and without ratsnest.
The first board has ratsnest on. Its a bit more cluttered. One advantage is thermal, having a greater copper surface glows for cooling of the board as well as larger conductivity specially in 2 sided boards as one side can be ground and the other side can be for VCC making almost all surfaces for power transfer. The second board looks cleaner.
I currently prefer making boards without ratsnest, because manual soldering can be imprecise and short circuits are easy to happen and the ratsnest feature can increase that.
The thick light blue contour drawn with the layer "milling" is used by the ULP pcb-gcode to create a G-code milling contour, the software will use that to create the limits and the cut can be used to detach the board from the copper stock. The thickness of the polygon will define the milling bit size.
Board BOM
qty | Location | Digikey or MouserPart number | Manufacture Part # | Description |
---|---|---|---|---|
1 | U1 | ATTINY45V-10SU-ND | ATTINY45V-10SUR | IC MCU 8BIT 4KB FLASH 8SOIC |
2 | R1 | 311-10.0KFRCT-ND | RC1206FR-0710KL | RES SMD 10K OHM 1% 1/4W 1206 |
1 | R2 | 311-100FRCT-ND | RC1206FR-07100RL | RES SMD 100 OHM 1% 1/4W 1206 |
1 | D3 | 160-1169-1-ND | LTST-C150GKT | LED GREEN CLEAR 1206 SMD |
1 | C1 | 445-1423-1-ND | C3216X7R1H105K160AB | CAP CER 1UF 50V X7R 1206 |
1 | FTDI | 6 pin header | ||
2 | Headers 1X4P |
A while back I started using the User Language Programs(ULP) called PCB-Gcode its a great program alows many settings that I discovered in part reading the documentation and in part with trial and error.
Bellow I show how I setup it for a smooth G-code creation.
The settings that I customized are:
In the Machine tab there are settings like: depth of cuts, unit, feed rates and tool diameter are chosen.
The G-code style tab is used to chose the post processor. I use Mach3.
Here is the visualization of the G-code provided by the ULP, arrow can be used to move around the image as well as plus minus signs.
4 files get generated
Bellow is the thermistor board isolation visualization.
Autoleveller is a great software. By probing the blank pcb and then using the file generated to adjust the depth of cut of the G-code, it ensures the milling machine will follow the relief of the blank pcb. I start Autoleveller runing its executable, there is no instalation needed on linux. Next click File and then Original G-code File (OFG): this will alow loading the original G-code in the program.
Click in the original G-code.
Click yes so the settings will be based on the file loaded
Next click on Generate PFG on the botom right of the window, this will create a G-code with a set of instructions, it will: -first probe the Z 0; -second probe several points in the area of the board; - tird it will ask for a location in other to save the raw file, that will later be used to create the autoleveled G-code.
This is the PFG file being saved. Next load this G-code to the cnc and follow the intructions on the G-code area.
Now its the time to attach the blank PCB to the CNC bed. I am no longer using double sided tape as its not as effective as the fixtures, also there is the need to clean up the leftover tape later.
In my cnc I have machined a pocket prior so the board has a fixed location, that helps immobilizing the blank.
In the CNC with the PFG loaded follow the instruction on the screen by attaching the probe.
Here I am attaching the probe to the surface of the board and the the alligator clip to the mill bit.
This video shows the probing process.
With the probing done save the raw file and take it to Autoleveller and load it.
Load the raw probe file back into the autoleveller.
Last save the adjusted G-code by clicking Autolevel on the bottom right of the screen. Save the file and take it to the CNC for the milling process to begin.
The final result is here, sometimes I use sandpaper 1000 grit to give it a better finishing.
Now I am going to show the boarder being cut.
avrdude -Cavrdude.conf -v -pattiny45 -cusbasp -Pusb -e -Uefuse:w:0xff:m -Uhfuse:w:0xdf:m -Ulfuse:w:0xe2:m
serial monitor : https://www.youtube.com/watch?v=9CX4i6rMXS8
attiny fan controler project: http://www.robotroom.com/DualFan.html
reads temp with arduino and ntc thermistor https://circuitdigest.com/microcontroller-projects/arduino-thermistor-interfacing-code-circuit
setup arduino 022: http://highlowtech.org/?p=1229
reflow oven project: http://pleasantsoftware.com/developer/3d/reflow/
pul up resistor (RES SMD 10K OHM 1% 1/4W 1206) from RST to VCC
decoupling capacitor (CAP CER 1UF 50V X7R 1206) from VCC to GND to reduce noise