Why spend your evenings and weekends welding and programming?

I have been following the pre buy prices of oil for a while now.  For those of you unfamiliar with the term “pre buy”. It is what is sounds like, the price of the oil you will have delivered is prepaid by you and you and your supplier determine how many gallons you should buy.  If you over buy you can usually take the remaining gallons you bought in a final delivery and store that amount in your own tank for next year.  If you can’t hold that much you get a refund, but my supplier would not hold that price for anything longer than one season.  If I under bought they usually would allow me the pre buy price on additional gallons if I used their estimate of how many gallons to buy.

Below is a .pdf chart of the pre buy prices  by year.  Note the chart also has a straight line regression trendline based on the existing data.  The line is extrapolated out and predicts what the coming years prices may become.  Note also that for a period of years the trendline and the prices were relatively accurate and tight to the trendline.   I think as time goes on the market may become more volatile.  The world market for oil is currently in the dollar currency.  This may also add to the price fluctuations as the dollar currency may become volatile as well as the oil market’s geopolitical issues may also add to the fluctuation.  Makes me want to get off the merry go round.  Note clicking on the link should bring up the chart as a pdf file.  Bear with me as a I try different ways to express things in wordpress.  Suggestions are welcome.

OilPrices2012


OpenLog partially tested

Well I have to say, I am not particularly impressed with OpenLog’s documentation but I finally got a sketch to work with OpenLog based heavily on the OpenLog command sketch.  I soldered up a Yourduino.com  Real time clock kit and am waiting on some male to male jumper wires to breadboard up a thermistor and clock to fully test the OpenLog data logging in a closer to real world trial.  Of course until it is finally mounted in the boiler control box and mounted on the boiler this will only be the next step in testing.

Hard experience has taught me many things work on the desk that do not work in the field due often to poor electronic practice, missing diodes, filtering capacitors, missing resistors….

Here is the code which I intend to run when I get the project bread boarded, it compiles but is untested.

/*
RTC, Thermisoter, OpenLog test

One thermistor attached to analog pins 0
The Real time clock SDA pin is attached to analog 4, the RTC SCL pin is attached to analog pin 5

The circuit:
Inputs
* Thermister  Analog in 0
* RTC SDA, Analog pin 4
* RTC SCL, Analog pin 5
Outputs
* Arduino digital 0 (rx), OpenLog TX
* Arduino digital 1 (tx), OpenLog Rx
* Arduino digital 2, OpenLog Grn

Created 8/24/12

http://www.frugaltinker.com
*/

#include <math.h> // include the library code for thermsiter functions
#include <Wire.h>
#include “RTClib.h”

//section for time keeping
int hour;                //hour
int minute;              //minute

int Roomtemp;            //room temperature

int statLED = 13;        //flashes LED connected to pin 13 for troubleshooting
int resetOpenLog = 2;    //reset on OpenLog

long DataDwell = 60000;    //seperates the data readings by 1 minute
long prevmillis =0;        // previous millis
RTC_DS1307 RTC;

//define function to calculate the temperature in fahrenheit for Analog pin 0
double ThermisterRoom(int RawADC) {//beginning of function
double Temp;
Temp = log(((10240000/RawADC) – 10000));
Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
Temp = Temp – 273.15;            // Convert Kelvin to Celcius
Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
return Temp;
}//end of function

void TimeSection() {//start time function
DateTime now = RTC.now();
hour=now.hour(),DEC;       //get the hour from the RTC chip
minute=now.minute(),DEC;   //get the minute from the RTC chip
}// end time function

void OpenLogData(){//start OpenLogData function
int RoomTemp = ThermisterRoom(analogRead(0));  //read from the sensor
Serial.print (hour);
Serial.print (“:”);
Serial.print (minute);
Serial.print (“, “);
Serial.println (RoomTemp);
}// end OpenLog Data section

void setup()
{//Begin Setup section
pinMode(statLED, OUTPUT);        //set pin to output
pinMode(resetOpenLog, OUTPUT);   //set pin to output

Serial.begin(9600); // initiate serial communication
//Reset OpenLog
digitalWrite(resetOpenLog, LOW);
delay(100);
digitalWrite(resetOpenLog, HIGH);
//Wait for OpenLog to respond with ‘<‘ to indicate it is alive and recording to a file
while(1) {
if(Serial.available())
if(Serial.read() == ‘<‘) break;
}
//Send three control z to enter OpenLog command mode
//Works with Arduino v1.0
Serial.write(26);
Serial.write(26);
Serial.write(26);
//Wait for OpenLog to respond with ‘>’ to indicate we are in command mode
while(1) {
if(Serial.available())
if(Serial.read() == ‘>’) break;
}
//send the open file
Serial.print(“Templog.txt\r”); //\r in string + regular print works with older v2.5 Openlogs

//Wait for OpenLog to return to waiting for a command
while(1) {
if(Serial.available())
if(Serial.read() == ‘>’) break;
}
// send the command to append the file
Serial.print(“append Templog.txt\r”);

//Wait for OpenLog to indicate file is open and ready for writing
while(1) {
if(Serial.available())
if(Serial.read() == ‘<‘) break;
}

//start process of setting clock time
Wire.begin();
RTC.begin();
RTC.adjust(DateTime(__DATE__, __TIME__));

} //End setup section

void loop()
{//Begin Loop section
if (millis()-prevmillis> DataDwell)
{//start if sections
TimeSection();           //displays the time
OpenLogData();           //saves the time and solar temp to the SD card
prevmillis=millis();
}// end if section

}//End loop section

 

 


OpenLog Firmware updated and tested

OpenLog is a data logger from SparkFun electronics that is touted as being easy to use and a reliable writer to a microSd card.  I haven’t found that to be true, I think it is a pain in the a** but maybe that’s the experience more than the actual product.  I ordered the data logger in January and got busy and didn’t have the time to use it so I set it aside.

Really the only reason I ordered it was because I could not get GoBetwino, a Freeware Arduino Data logging software program to work.   The GoBetwino program uses a USB connection to a computer connected to the Arduino to log to a file on the PC.  A great concept that I tested and worked fine on the desktop machine.  However on the laptop that I was using to make changes to the Arduino controlling the boiler  in the shop it didn’t work.  It seemed easier to come up with a standalone solution rather than troubleshoot the USB connections, the power managment issues with the Laptop etc.  So I bought the data logger.

As I wrote in an earlier post since the time of my purchase of the OpenLog board it was recommended to update the firmware, this required updating the board with a FTDI board that accepts the USB connection from the PC to update the firmware, after 2-3 hours of frustration this task is finally completed.  The main problem being Windows XP didn’t seem to recognize the FTDI board and assign it a com port but finally was able to find the correct driver and download the firmware.

I ran the test sketch, pulled the micro SD card and reviewed the data.  The board  did log the data correctly so the next step is to write a function that writes temperature data to a file with a time stamp.  Since I have an Arduino on my desk with a real time clock chip that measures the outside temperature  as well as the temperature of a solar hot water storage tank this would seem like a perfect application to test.   After testing the function in that application it will be easy to modify the function for the monitoring of the boiler function.  I prefer to write the code in functions and call the functions from the main body of the loop.  This makes the code modular and easy to reuse.  I comment very carefully and probably over comment, but I personally prefer to make the code painfully simple to understand on the assumption I may not look at the code again for a few years.  I am hoping you will comment as well since your comments will no doubt improve the code.

I will post the function when I complete it.  Thanks for reading.


CNC Plasma cutter works with Sharpie!

After assembling all the lead screw nut to carriage connections the machine is testable.  I ran a  program supplied with Linux Enhanced Machine Controller that required coordinated motion between the axes.  This came out in an interesting way, mirror image.  I figured out that the y axis was opposite from the expected direction, or in other words, when the program called for a positive y axis move, the machine delivered a negative y axis move and vice versa.  This was a simple fix, I  physically picked up the axis and moved it end for end with a helper and remounted it.  After that the test program ran just fine.

Mirror Image with y axis reversed

Image with corrected axis, you can see a little of the same program showing the E in the correct orientation, as well as a 5″ x 5″ box program that I was able to import from StepCam,  although I did have to edit the program to get it to run.

Corrected axis Image of the start of the same program

Next on the CNC list is to order some additional materials from McMaster-Carr to finish the Z axis as well as some electrical routing accessories to finish the limit switch installations.  Last but not least I will need to improve the mounting of the sharpie, plasma cutter and whatever other option should be available for this machine. No doubt a router head would be useful as well.  I have the material for the fabrication of a base so I will start on that this coming week as well.  Of course this is not the only thing on my list, I still have to make a living so progress will be measured in hours.  Thanks for reading, and tell your friends.


CAD/CAM Software tested and produces code

After doing some internet research I have decided to go with Google Sketch Pro for the drawing of parts to produce a .dxf file., this will cost me a dollar or two but I have gone through the Google sketch tutorials and it is a powerful program.   Google Sketch Pro is a CAD program, CAD standing for computer aided design. The CAD program is just the first step in a three step process of drawing the part and from that part drawing producing a .dxf file.

The second part of the process is to import the .dxf file into a program that will convert the geometry into standard G & M code this is a CAM program, which stands for computer aided machining.    The program I have decided to use for this is SheetCam.  SheetCam is a 2.5 axis program which makes it a little simpler to use.  Of course the machine moves in the x and y directions but the third direction the z axis on a plasma cutter is really just up and down without much coordinated motion between the x and y axes while the axes are moving, we aren’t routing a 3D sculpture we are cutting a profile.

The third step is to use a third program which is a Linux based program called EMC which stands for enhanced machine control this takes the G & M code  and translates that code into stepper motor signals that are exported through a parallel port to a Xylotex box which controls the motor motion to the 3 axes.  Xylotex is the manufacturer/ integrator of the stepper motors and stepper motor drive boards.

At this point I have drawn a 5″ x 5″ square, downloaded that dxf file from Google Sketch Pro and created the code with SheetCam.  The SheetCam program has a EMC post processor as a choice and I have the program ready to load into the laptop running Linux EMC to test the motions and accuracy of the CNC machine.  I was able to draw the simple rectangle and convert it to G&M Code in about 3 hours this morning.  Not a record but this does speak well for a well written intuitive CAM program, I had previous experience with Google Sketch so that doesn’t really count but I do like that program as well.

It hasn’t all been desk work I have also been turning the Bridgeport handles.  The Y axis carriage plate has been built and awaits longer screws for final assembly.


CNC Plasma cutter progress

I  finished the assembly of the two  carriages on the x axes of the CNC machine.  The y axis is mounted and this next week the goal is to assemble the carriage to Acme nut connections and build the linear carriage for the y axis.  So if all goes as planned next weekend or sooner could be the first prototype test of the machine, the z axis will not be workable but I am sure I can find a way to attach a pencil the axis to see movement.    That is a great goal for the week.

My SparkFun package of an FTDI Adapter board and and second board will allow me to reload the firmware on the OpenLog board I ordered in January.  I am dreading this a bit, electronics and computer area things are my weakness so I am a bit nervous but will tackle this job and test in a example sketch this week.  I’ll bet that will take any free time I may have up but will get me that much closer to my goals.  X Axis-CNC Plasma Cutter


CNC Plasma cutter, Fall plan

Having taken most of the spring and summer off after last winters heating season, it is now time to review progress and regroup to make more progress.  I have been spending part of my “free” time working on a CNC Plasma cutter.  The goal of this machine is to improve the speed of prototyping and aid in the quality of the  parts produced.

I’m not a very patient person so having a CNC make the cuts instead of me trying to either free hand or follow a straight edge with the plasma cutter will definitely improve the quality especially of the welds.  At this point I am building the carriages and exploring what software to use in conjunction with the cutter.  I am intending to use Mach 3,  but I need to review and find a CAD program and CAM program that work together.

In conjunction with the CNC project I am working on getting a SparkFun OpenLog device to log data to a MicroSD card.  At some point I know this will be useful to the project.   I ordered the OpenLog from SparkFun in February so with the new Arduino IDE (1.0.1)  the firmware for OpenLog needs to be updated.    This requires ordering a FTDI board or using a FTDI cable. a second board is recommended as well.  These items are on order and should arrive this week.  Of course after updating the firmware and config file,  the next step will be getting the software integrated into the Arduino sketch to make it a practical useful device.  I think when I get that done I will make that section of the code a function and post it to the Arduino forum.

Lastly I am working on a PID control for the software, this is really in the development phase and not a lot of time has been spent on this aspect.  To enable the boiler to convert from pellets to chips to sawdust to acorns? I know the software will need to adjust the burn parameters to make the product burn seamlessly.

Oh yeah I almost forgot, I have about 6-8 tons of chips in my driveway waiting to be dried.  The drying needs to be done by me building a dryer…for now I am focusing on the CNC cutter and when McMaster-Carr or UPS fail me I can fall back to working on OpenLog functions for practical data collection.