aramok

aramok

Saturday, September 27, 2014

CLACK - COMPLETE


https://plus.google.com/photos/101425767694746849316/albums/6063926866267257521?authkey=CLa84_mB7P2yywE


















Click image or more image^
Code HERE
User Manual HERE

I have just moved to my into my new garage home here in Corvallis, Oregon, where I plan to attend Oregon State University for the next few years as an electrical engineering student. Before I left California, I spent two months of my summer hard at work on three projects. Two of them turned out wonderfully, another did not, however this is one that did.

After much deliberation, I have finished my clock. It has taken about 6 months, of what ever free-time of my free-time I have had, to design and build the CLACK into a permanent and complete version. The final features are as follows. Year to Centisecond time displayed on Sixteen, 1970's led numeric indicators, copper and wood case, four alarms, time settable, Real Time Clock with ±4ppm accuracy, and an alarm speaker that also makes a faint ticking noise every second.

I built this clock very much from scratch. Somethings I admit could and should have been done better if I had acquired the proper tools. Its two circuit boards were made using strip board, solder jumpers and tiny wires. Only a few weeks after I began building the clock on strip board did I figure out how to cut out PCB's on my CNC machine at work. Using strip board for something this small and space sensitive was ultimately not the way to go but at the time it was the only way I had. I have had probably twenty different shorts, incorrect wiring and complete section do-overs to make things fit.

The "Operating System" as I came to call it, the program that the clock was loaded with, ended up being about 500 lines long, and the most obese program I have ever written. Not many library's could be used to save time. The program is fairly well commented (from my perspective, probably not so much a first time reader) and could be helpful to you in many areas of Arduino clock programming. Firstly, how to control and poll the Real Time Clock, DS3231, using a DS1307RTC library. Using this DS1307 libary for the DS3231 has no compatability issues and is my favorite libary out of the three I found. I like its method of storing time in its own updated "public" variables like "tm.year" every second so that I can retrieve it with my code simply by saying myYear = tm.year. Also my button reading approach is a helpful trick. My Shift Registrar display usage, specifically how to use two in series. Try to ignore the "modes" and "cursor place" programming implementations, they are convoluted and not worth wrapping your head around, but they work for this application.

I came up with (probably rediscovered) a nifty way to "Debounce" the input buttons on the back by implementing a timer to check how long a button was held down. Piggybacking off the centisecond timer that is already running, each button was checked for a depressed state one hundred times a second . If after 5 centiseconds the input has not gone LOW even once, the buttons action would be triggered. If the button dose go LOW in that time, the buttons personal counter will be reset to zero. This feature can be piggybacked as well because it not only can be used for debounce but also as a detector for if the button is being held. For example the enter button needs to be head for 500 centiseconds to go into TimeSet mode.

The physical design of the clock is a copper layer cake wrapped in an icing of wood. The layers from front to back are as fallows.  First a shinny a copper plate with windows cut out helps define the separation of the groups of numeric indicators. Then the numeric indicators sit on-top another copper plate with two slots for the pins to feed through. Then, first single sided strip-board PCB. That PCB plugs into another PCB with 16 connections for "indicator select", 5 connections for the {1,2,4,8,DP} and 2 connections for display power supply. After which there is a plastic insulator for the second PCB so that it dose not short on the copper back plate that has five square holes for the buttons to poke out. All of these layers are head together with four bolts (not pictured) and alot of thin nuts to space everything out to a total witch of 0.7 inches.

I was going to just leave the clock like that, but considering all the finicky wires that could pop off from flexing or something, I had to cover the sides. I planed to give this clock to my father as a going away present, so it had to be somewhat durable, I wouldn't be able to fix a solder joint from five hundred miles away so it had to be robust enough NOT to be garenteed to break, like most of my DIY projects. So I relentlessly built a wooden case for it. I made a slotted sleve it slid into with a cap on the end with a hidden bolt. I don't have the tools for tiny wood workmanship, but I made do with my CNC used like a milling machine and a file.

Well that's that, as always I hope something from this project will be of some use to you. Tune in next week for an artical about my experience with some reeeal electronics. ;)

Wednesday, May 21, 2014

Desktop CNC



I currently work at a place called Arrgh!! manufacturing. A local electronics shop that makes specialty devices for businesses, mostly a hydrogen gas detector and a few devices for maintaining lead acid battery's. These days, I help with the engineering side of things, making and fixing machines to facilitate the mass production of the products we sell.

My recent task has been the setup and operate a desktop CNC machine for making small quantity's of prototype parts. These small CNCs have become quite popular with the DIYers. They are very high precision and have a small but very effective bed size. They go for about 600 bucks, but they are not plug and play, easy to use machines. The CNC came into the shop, a ragtag lot of components, each part made by a different no-name Chinese company with only a photo copy of a picture describing what plugged into what.

The package came with:
  1.  A 3 axis machine with drill motor attached 
    1. Drill Motor, 800W, 400Hz/12000RPM
    2. A few engraving bits, end-mill, tools
    3. clamps (extremely under-engineered)
  2. Stepper motor controller.
    1. The PC parallel port communicates direction/step to the controller which then powers the stepper motors
  3. 3 phase motor driver. 400Hz. manually controlled.
  4. Pump & tubes, NO radiator
    1. The motor is designed to be water cooled, but it is necessary
    2. My manager wanted me to build a water cooling system from a PC cooler before turning it on to test how hot it got under load. As it turns out, the water cooling is not needed, The large aluminum clamps holding the motor to the large aluminum CNC table seams to be sufficient to cool the motor, even under a heavy work load.
A lot of software is needed to operate the CNC. Cad software, Gcode generation software and then Gcode executing software. Gcode is the world standard CNC script. It contains a list of simple instructions in text format and can contain thousands of lines. I use Aspire to generate my Gcode, and I also use it to draw 2D vectors. Real CAD software would be required for any precision 3D work. The CNC itself is controlled by a PC program called MACH3. mach3 interprets Gcode instructions in real time and pulses out direction/step signals through the parallel port. It is up to the settings in MACH3 to apply the amount of stepper motor steps per inch. Without further adieu, here's my list of my biggest headaches, in order of occurrence:


  1. The Parallel port must be in a certain mode to work. In the BIOS, the parallel port must be ECP or EEP depending on your controller. proper addresses must be set in MACH3 too.
  2. Although the "manual" had the correct parallel port addresses in the screenshots, all the other information was incorrect. Most notably the Steps Per Inch numbers were way off. In order for mach3 to move the CNC to the correct location (say 6 inches), it must be configured to know that say, 4184 steps is equal to one inch. Even though most CNCs use 1.8 degree per step steppers, the design of the worm gear will determine the distance per revolution. On top of the all the reverse engineering involved to get the thing running right, I needed to set up the machine for inches, instead of millimeters.
  3. MACH 3 also has configurable speed and acceleration curves. The CNC can jam for no particular reason if the speed and acceleration are in correct amounts for what I call a "jamming resonation". Jamming resonation can occur when the stepper motor stepping happens at a frequency that the whole machine resonates to. The vibrating machine has the effect of kicking the stepper motor back wards enough that on the next step, the motor turns backwards, then forward again on the next step, back and forth and back and forth. The machine usually oscillates like this for 20 steps until it breaks out of its loop and continues on its way. Of course the problem is Mach3 thinks nothing has happened and the CNC loses track of its true position.
  4. For cutting metal like aluminum and copper, the rate in which you design your Gcode to "plunge" and "feed" greatly effects cutting performance. It usually has to be done off the cuff and it takes many attempts to achieve a good quality cut. Too fast and the cutting motor will screech to a halt while the CNC continues ramming into the piece. To slow and... well you get bored waiting. The speeds in between will give you different amounts of unwanted burrs left over that have to be cut off, ground off, and sanded off. There are standards for choosing feed rates based upon number of "flutes" (cutting edges per rev) on a bit and what type of metal is being cut. However the motor on this CNC can not provide enough power to cut at normal speeds and needs to go much slower then the recommended feed rate.
While the Desktop CNC does "SEE EN SEE", getting good results takes a lot of practice. I can say it takes less skill then it would to operate a milling machine by hand. I can't recommend this CNC package unless you are willing to make IT your project rather than use it FOR your project. The next post about the CNC machine will surely be adventures into engraving copper clad PCB boards for prototype circuit boards. I have heard it's finicky business, but I hope it will prove invaluable to my work and my own projects. If you have any questions about this CNC, I am eager to answer them.
Wuba-luba-dub-dub and a good day to you!

Wednesday, May 14, 2014

CLACK



 Code HERE

I have wanted to build a clock from scratch for some time now. Building a digital clock is not terribly original even if it has original features, but as an Electrical Engineering student I felt the challenge would flex muscles in areas of display control, multiplexing, product design and programming. There are all kinds on silly, nutty, or future rich clocks made by makers all around the world, I see at least one new time keeping device on the web each day. This is my approach. Its flagship feature is an ancient LED display, made up of sixteen Hewlett Packard "Numeric Indicators" (1990-0330, similar to the 5082-7300 in this datasheet). Each has 8 pins; Vcc, GND, Enable, 1, 2, 4, 8, and Decimal Point. They have built in decoders, so the number you want to display can be selected by setting the parallel binary input pins HIGH or LOW, and toggling the "enable" pin LOW to except input, and setting it HIGH again to hold the number.

These little guys get HOT, almost too hot to hold your finger to. LED's? Hot? After some digging around I found an HP Journal from 1969 Describing these "Numeric Indicators" in detail. The LED as we know it was only invented 7 years prior. They are not the efficient LED's of today, 16 indicators consume 1125mA@4.7V (The thing loads down the 5v rail on my computers PSU). Turns out they go for about 15$ a piece but I acquired them from e-waste along with a load of 74 series logic chips. Somebody many years ago was planning on building a calculator I think.

To select which indicator to enable to except input, I use two shift registers. Shift Registers are a very useful IC in EE's arsenal for controlling many things (arrays of LED's, buttons, and other ins and outs) with only a few pins from a micro-controller. I can serially output a number like 1111,1111,1011,1111 (65471) into the two registers (which act like one 16bit register once two are connected in series) in order to select the 10th indicator. Then I can display my number, say 5, by applying [1,0,1,0] to the pins [1,2,4,8] of all 16 indicators, knowing only the 10th will change.

The format of the time display is,  YYYY MM DD   HH mm SS.ss (60.00 seconds has Deci' and Centi' seconds). The time keeping is done by a Real Time Clock board based on the DS3231 by Maxim, it has a high precision crystal with temperature compensation, a backup battery, and registers that can be polled by an I2C connection. The registers have all the year, month, ect., stored as their normal values and are compensated for leap year, and so forth, which makes programing a cinch. Time formatting can be a programers nightmare if done from scratch.

The RTC module dose not, however, report any unit of time smaller than a second. I needed to create a centisecond timer that would run between each second. [[go to paragraph 7 to skip problematic efforts]] Originally I wrote the Arduino's main loop so that the RTC was repeatedly polled as quickly as the Arduino could, and when the seconds place changed, the Arduino would start a timer from 00 - 99 to display centiseconds. The timer was based on an interrupt where every 100th of a second (based off the Arduino's crystal) the interrupt would interrupt the main loop and display the next 100th of a second. This would cause the main display to flicker annoyingly as the display update would be interrupted 100 times a second.

In an attempt to remedy this, I flipped it round. I had the interrupt fire once every second, poll the RTC and start the centisecond counter. However the Arduino's definition of a second differs from the RTC's second, so every so often the seconds place would skip. Sometimes the arduino would poll the RTC right at the beginning of the RTC's second, and then again at the end of the RTCs second, because the Arduino's second as to fast. The seconds place would appear to show a second for two seconds and then skip a second ahead, about once a minute.

Thank you! The RTC module has a square wave output pin than can be configured to be many different frequency's. I wanted to use a 1Hz wave to tell the Arduino that a new time is ready to be read from the RTC. A certain register inside the RTC has to be written LOW to enable this 1Hz output. In my Arduino's loop, I set a check to see if the square wave has gone high every 100th of a second while the centisecond loops. The end result is a very smooth clock display. It bugs the hell out of me when software clocks don't update the seconds place EXACTLY on the second.

To finalize the design, the clock will be split into a two layer board were only the display will sit in front with all the components sandwiched behind it. A few buttons in the ol' "4 arrow keys an select" configuration will sit in back. They will be used to set time, alarms and a death clock. I hope you learned something about something from this project that will be of use to you!

Monday, May 12, 2014

Slaves to Aramok: God of Grape Juice

Welcome to my new blog, Slaves to Aramok. Before we get started, It is important I make the distinction that this blog is NOT for; Slaves to Armok: God of Blood. This blog is for Slaves to Aramok: God of Grape Juice. To reiterate,

This blog is for,

SLAVES TO ARAMOK: GOD OF GRAPE JUICE

not,

SLAVES TO ARMOK: GOD OF BLOOD

If you are a Slave to Armok, or would like to become one, click here.