Categories
Projects

Rev 2 PCB

So the last PCB with the tacked on diodes finished off the 2014 season. I did have an issue at the begining of the year, but luckily that was just an isue with the 5v wall wart I was powering board with.

 I pretty finished next PCB design sometime toward the end of the season, but never got around to ordering it, or the new parts I needed. I kept the diodes on the back of the board between the coil pins, but used a DO-213AA package. I switched the relay indicator LEDs and paired resistors to 0603 SMD components. Which turned out to quite small. With a no-clean solder syringe they were quite easy to solder, though. I did use my stereo macroscope and it helped a lot. I found out after I ordered my PCBs from Tayda carries 0805 resistors, so any further revisions will probably switch to those. Tayda also now carries relays with the footprint I use. So, potentially they have everything but the SMD LEDs, SMD diodes, and 2.54mm pitch screw terminals.

 There, of course, was one issue with the PCB I found after testing the SMD LEDs before I put anything else on the board. I accidentally put a trace between the pads for LED3. A sharp razor blade made short work of fixing that though.

As long as everything keeps working, I’m not going to do much with this for a while, but try to document it a bit and get the files in better order.

Update: I have the Fritzing file on Github

Categories
Projects

New Project Delivered

I’ve had a laser on my list of tools to acquire for well over 10 years. I’ve thought about building one, but with no prior experience with laser tubes I never really felt comfortable starting that project.

I noticed, maybe last year, cheap Chinese made 40w laser cutters (K40) has been coming down in price and contemplated getting one, but my money was stretched to thin between other projects. At the time and I only had $50/month budgeted that I could spend without the wife’s say (we call it blow money) because we were on the last stretch of a multi-year effort of pouring extra money into the mortgage to pay off our last debt. Plus I would need to build a new controller for it because I couldn’t find anyone happy with the software it came with.

I came across a buildlog for conversion of one of these lasers a couple of weeks ago. He had the laser at $487 and replacement electronics at $65.  It had been a few months since I really spent any blow money… I could do $550 in another couple of months.

I started shopping and found the laser for $387 and the replacement electronics (Arduino Mega2560, RAMPS 1.4, Reprap Smart Full LCD, and A4988s) for $35 total.  Done.

A week later I found a crate on my porch. Most importantly everything, including the glass tube, was in one piece. Pulling the box out of the crate was a bit awkward by myself, but it was going to be hours before my wife got home, so I managed.

The software came with a USB hardware key. (really!?) Trying to get that to work with Wine under Linux was probably not going to be worth the effort to test it since I was going to pitch it after replacing the electronics. Microsoft products don’t run in my household, so I’ll just have to wait for the new electronics before I can test it.

I didn’t realize the K40 laser intensity was manually set only with a potentiometer. So, not only is the Arduino/RAMPS open source and run with g code, it adds the ability to dynamically change the power output during a program. It looks like I should be able to just drop the firmware in place thanks to Lasing Makers Network and TurnkeyTyranny modifying Marlin (the firmware the 3D printer RepRap uses) for use with this laser.

Categories
Projects

New PCBs, New Problems

The new PCBs arrived and I soldered everything on, testing as I went. I used an Uno to bit-bang the Duemilanove bootloader to the Atmega328P. ICSP programmers are pretty cheap on eBay, so I ordered one for the future. The headers below the Atmega are for a USB FDTI adapter for uploading sketches. Everything worked great on the bench with no solenoids connected– you can see where this is going.

Once I installed the board It would cycle through one or two steps of switching on/off solenoids and reset. I pulled it out and gave the board a good looking over and found a possible problem. I left some points for the extra digital pins (which was down to 1 after I realized my mistake mentioned in my last post) in case I wanted them for something in the future. When I fixed the last problem I, for some reason, decided to also connect the 5V point, from a trace that passed the VCC supply pin on the Atmega to a trace supplying the relay coil power. I cut that extra trace and it now worked better, but only for a minute or two.

The only thing I could think of was some interference from the current in the 24v solenoid circuit. I now know that interference to be called di/dt (dee eye by dee tee). When the solenoids shut off the inductance of the 24V wire creates high voltage(radio wave) that jumps to the relay coil (antenna). That spike doesn’t do good things to microprocessors.

In my sketch I had 4 of the 8 relay pins randomly selected and turned off, then four randomly selected of the 8 again. So sometimes 4 relays could be shutting off at the same time. I changed the code to select one relay that was engaged and swap it with one that was off. It actually cycled through the entire program… sometimes.

The Darlington array (ULN2803) has internal diodes, but maybe they weren’t good enough? I soldered a 1N4803 Diodes between the coil pins on each relay. The polarity is backward of the current on the board, otherwise, it would short the DC– which would be bad. But it does still short the high voltage AC from the di/dt– which is good. Success! Working as planned. It’s been running for 2 days with no issue… so far. I’ll see how it works for a while before I bother creating a new PCB design including the new diodes. Even with a third (and let’s just assume I’ll need a 4th) round of PCBs, with the components for 3 boards (2 backups), I’ll be under $200. With a price tag of $2K on the replacement computer that I had no confidence in and would still be waiting to arrive, I feel pretty good about this. I’m not a programmer and the Arduino IDE is my only exposure so far to C++, but here is the sketch that I painfully got to work.

int stepLength = 6000;//6 sec steps
int steps = 50;//50 step
//6sec * 50 = 5min
int waitState = 1;


void setup(){
  Serial.begin(9600);
  pinMode(2, OUTPUT);
  pinMode(4, INPUT_PULLUP);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
  
}

void loop() {
  digitalWrite( 2, LOW);//turn off motor
  digitalWrite( 4, HIGH);//HIGH is inactive for internal pullup
  int pin = 5;
  while(pin <= 13){//turn off all solenoids and run led
   digitalWrite( pin, LOW);
   delay(100);
   pin++;
  }
  waiting(); 
}

void waiting(){
 if(waitState == 1){ 
   Serial.println("Waiting for Input...");
   waitState = 0;
 }
 if(digitalRead(4) == LOW){//wait for input
   beginSeq();
 }
}

void beginSeq(){
 digitalWrite( 4, HIGH);//HIGH is inactive
 digitalWrite(13, HIGH);//turn on run led
 startFour();//open 4 solenoids
 digitalWrite(2, HIGH);//start motor
 delay(stepLength);
 int stepNum = 2;
 while(stepNum <= steps){
   Serial.print('\n');
   Serial.print("Step ");
   Serial.print(stepNum);
   Serial.print(": ");
   swapFeature();
   delay(stepLength);
   stepNum++;
 }
 Serial.println("");
 digitalWrite(2, LOW);//stop motor
 digitalWrite(4, HIGH);//deactiveate input pin
 delay(5000);//wait 5 seconds before all the solenoids slam shut
 waitState = 1;
}

void startFour(){
 Serial.print("Step 1: ");
 int pin = 5;
 while(pin <= 12){
   digitalWrite( pin, LOW);
   pin++;
 }
 int i = 0;
 while(i  ");
 Serial.print(turnOn);
 digitalWrite(turnOn , HIGH);
 digitalWrite(turnOff , LOW);
}

int turnOffPin(){
  while(true){
   int pin = random(5,12);
   if(digitalRead(pin) == HIGH){//check that pin is on
    return pin;
   }
  }
}

int turnOnPin(){
  while(true){
   int pin = random(5,12);
   if(digitalRead(pin) == LOW){//check that pin is off
    return pin;
   }
  }
}
Categories
Projects

PCBs Arrived & Error Found

The boards look great. Itead did a great job and I got them quite a bit faster than I expected. Unfortunately, I made an error. I managed to, rather than connect to a signal pin on the Atmega, connect the circuit to open the relay intended for the motor controller to a VCC pin. There are 2 extra digital pins free that I left solder points for. I’ll be able to cut a trace and solder on a jumper wire for the time being. I fixed the error in Fritzing and after looking it over for the next couple of days, I’ll order another set of boards.

The Pro Mini I have running has needed reset a couple of times this week, but the old computer controller needed rebooted every couple of days as well. But if I get a call about the splashpad not working, with the arduino, I have no problem saying unplug and plug it back in. 2 seconds after that everything is back in operation.

Update: The controller got stuck again repeatedly. I looks like the problem was being caused by the wires for the input pin from the motion sensor relay being too close to the 24VAC solenoid wires. I re-positioned the wires and have not had an issue since.

Categories
Projects

PCBs Ordered

I played with some parts and finished a PCB design in Fritzing the last few days. I’m still waiting for some terminal connectors and relays I had to get on ebay. 10 copies of the board + shipping is going to run under $30. I opted for the cheap shipping so it’ll be a few weeks before they are manufactured and make it here from China. The Pro Mini I have running things at the moments is working fine, so I’m not in a rush and I tend to prefer keeping my money rather than getting something faster anyway.

Categories
Projects

Splashpad Controller

The pool that I work at installed a splashpad a couple of years ago. It was a great addition and has been quite popular. Being much easier to prepare than the rest of our facility we’re able to open it up at least a month ahead of the rest of the facility to give our members and the community an extended season.

As it was being installed and while it has been in service since, and as I always do, I thought a number of things could have been designed better. In particular, I thought the controller was a bit ridiculous.

The slashpad is activated with a motion sensor which is great, not only because we don’t have to turn it on and off manually, but because the children enjoy running over to wave their hand in front to turn it back on as much as playing in the features. A 3HP motor is turned on and 8 of the 12 features use 1″ or 1.5″ 24VAC solenoid to cycle through the features leaving 4 on at any given time. It runs for 15 minutes and turns off awaiting a signal from the motion sensor.

In the image of the setup, you can see the PCBs from the controller. The top left appears to be a master controller for serial communication, below that is the board the input from the motion sensor connects to and below that is a bank of relays for the solenoids. On the right is a 120VAC/24VAC transformer and DC converter that powers the boards and remote motion sensor. Nothing too fancy, it looks like a pretty standard industrial controller. But then all of this is controlled by a touch screen computer running Ubuntu Desktop with a GUI build on a LAMP stack.

The GUI gave us no function other than a large on off button. There was a menu with links that required a login that was not given too us, but the htpasswd file was in the normal place in plain text. So that gave use a diagnostic page and and editor for the sequence, but it wasn’t terrible useful. It did look like there was some intent to have remote access for the company to configure or diagnosis things, which would make an embedded server a good choice, but I would have opted for a headless setup.

There were two problems I anticipated with the setup. The first was heat. The whole thing, including the x86 computer with 2.5″ hardrive was sealed in a plastic box in a shed outside during summer. This did become a problem and we had to leave the door open on the box to keep the computer running. This introduced another problem of moist air with chlorine ions entering and there are now points were corrosion is developing.

The second problem was dealing with the desktop operating system having problems, as they do. Once in a while, things would not operate but was solved by a reboot. The touch screen was small and not calibrated perfectly and without that difficultly added getting the managers comfortable with shutting down Ubuntu was not going to happen. The habit was to unplug it from the wall to turn it off. So I figured the hard drive would fail in a couple of years at most.

A couple of weeks ago I was greeted with the click of death when I checked on it in the morning. We had a storm and power outage the night before so that likely had something to do with it. I had made a copy of the webroot and some binaries for the serial controller, so I hoped I could get it all reinstalled on a new harddrive.  After being unable to boot even after replacing the hard drive I cracked open the computer and with all the corrosion gave up on it. The boss contacted the company to get a new computer and it was not in stock, so it was going to be a while.

The boss wasn’t too excited about the only feature we had open being out of order and hoped I could get it functional in some way in the meantime. I had been thinking about how I would design it for a while so the plan was already in my head. I grabbed an Arduino pro mini and a relay board from home along with a perfboard, headers, and connectors from Radioshack. After a couple of hours, my less than $25 controller was running. The only notable difference from the outside (If you were a really keen observer) was the features switched randomly rather than in a predetermined order.

After a week we finally heard back about the new computer. It was going to take a couple more weeks after we approved the over $2000 estimate that took them a week to get to us. We had just spend a good deal of money on repairing a bit of old infrastructure that failed and we were not in the best financial spot. My boss asked if there was a reason we couldn’t keep the current setup. It was a little slapped together, but I said we could probably keep it functioning well enough and I could design it a bit better and have a couple of drop-in replacements ready for well under $2000. So, I ordered some parts for Tayda, started prototyping on a breadboard, and am starting to design a PCB in Fritzing.

I’m going to stick with the Atmega328P. It will likely be useful for other things (like a drip irrigation controller I need for another project), so I’m going to aim for cleaning things up enough to release the source.