Jump to content

nickey

Members
  • Content Count

    24
  • Joined

  • Last visited

  1. nickey

    Question on these Resistors

    Sounds good to me.. thats the way I will keep it, with no resistors.. Thanks Rob
  2. nickey

    Question on these Resistors

    Ok, that just created a new question. I measured 178ma through the relay coil when activated and so I came up with a calculated 68 ohms for a collector resistor.. but when I put it in the circuit, the relay wouldn't trip any more.. I had to drop down to a 22 ohm resistor before it would engage, and after only a few seconds the resistor (1/4 watt) gets very hot.. don't think that will work well when the pump is on for 5 or 10 minutes at a time.
  3. nickey

    Question on these Resistors

    Thanks for both of your answers, that helps a lot. I will implement your suggested changes.
  4. nickey

    Question on these Resistors

    In examining my fish tank aerator circuit, I am uncertain about the use and value of a couple of resistors. (I acknowledge I am a tinkerer and not an EE).. 1. What is the purpose of R2? is it needed? (I copied its use from a different relay driver circuit) 2. Though they both seem to do the job, how would I calculate the correct values of them? (I just started with them first as is) thanks water pump relay.doc
  5. nickey

    Fish pump aerator - ready for critique

    Thanks for the comments, no I haven't looked at overall power consumption yet.. good idea though. My current thoughts are that since I control the on and off times that I can keep the battery drain to negligible. Might look at your suggestion in the future though.
  6. nickey

    Hi all from Spokane WA !!

    thanks Rob, those look great, I just ordered some samples from TI.
  7. nickey

    Fish pump aerator - ready for critique

    hi Mike, wow thats just what I was looking for.. My only experience with micro controllers is the TI MSP430 and so I have no knowledge of the PIC systems.. Did it take much programming on your part? Also did that chip allow you to drive a relay directly from one of the pins? My relay has a coil taking about 200ma to activate it so I had to use a transistor.
  8. nickey

    Hi all from Spokane WA !!

    RobG, thanks for the info on choices other than LM317. I looked at TI and then LT at their stepdown converters, but unless I am reading them wrong, they all seem to be packaged for surface mount. I don't have that kind of accuracy in my tinkering space and so unless they also have some with nice big pins on them I don't know if I can ever use them.
  9. nickey

    OK, in deeper water now...

    Thanks zeke for the nice pointer to all the relay circuits.. I actually ended up copying one of them for my circuit (now posted in projects). As for mystboy and optocupler, thanks for the idea but it looks like I have found a solution with the parts I have on hand.
  10. Ok, thanks to all of the great help I've had on this forum, I have this working on my breadboard and would love to hear any comments or criticism that could help me turn it into a better circuit or better coding. Warn you in advance that my circuit layout and C++ structure is far from professional. //*************************************************************************************** // Fish tank aerator // final version 1.0 // April 2011 // Built with Code Composer Studio v4 //*************************************************************************************** #include #define freq_10 BIT0 //Port 1 bit 0 #define freq_30 BIT1 //Port 1 bit 1 #define freq_60 BIT2 //Port 1 bit 2 #define dur_5 BIT3 //Port 1 bit 3 #define dur_10 BIT4 //Port 1 bit 4 #define freq_LED BIT5 //Port 1 bit 5 -- LED indicating frequency timer is active #define dur_LED BIT6 //Port 1 bit 6 -- LED indicating duration timer (pump) is on #define pump_relay BIT7 //Port 1 bit 7 void clear_states(void); //function to reset states void clear_timers(void); //function to reset all timers and interrupts and setup Ports void set_freq_timer(void); //function to setup frequency timer int freq_state = 0; int dur_state = 0; int timer_state = 0; int freq_timer_active = 0; int minutes_counter = 0; int half_seconds_counter = 0; int seconds_counter = 0; int timer_goal = 0; void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer clear_timers(); // reset timers clear_states(); // reset states //*************************************************************** // Poll switches loop //*************************************************************** for (; { freq_state = (P1IN & (freq_10 + freq_30 + freq_60)); if (freq_state == 00) { clear_timers(); //if frequency switch is off clear_states(); // reset states } else { dur_state = (P1IN & (dur_5 + dur_10)); //get pump duration from switch if (timer_state != (freq_state + dur_state)) //if switches have changed since last time { clear_timers(); //reset any old timers set_freq_timer(); //setup new frequency timer } } } } //*************************************************************** // Clear Timers and Interrupts and Initialize Ports //*************************************************************** void clear_timers(void) { TACCTL0 = 0; //disable interrrupts for CCR0 freq_timer_active = 0; //clear active timers minutes_counter = 0; //clear the minutes counter half_seconds_counter = 0; //clear the half/seconds counter seconds_counter = 0; //reset seconds counter timer_goal = 0; //clear timer goal number P1IE = 0; //disable all ints port 1 P2IE = 0; //disable all ints port 2 P1OUT = 0; //clear all pins on port 1 P1DIR = 0; //set all port 1 pins to "input" P1DIR |= dur_LED + freq_LED + pump_relay; //set port 1 LED and PUMP pins to "output" } //*************************************************************** // Clear States //*************************************************************** void clear_states(void) { freq_state = 0; dur_state = 0; //reset states timer_state = 0; freq_timer_active = 0; } //*************************************************************** // Setup Frequency Timer //*************************************************************** void set_freq_timer(void) { timer_state = (freq_state + dur_state); freq_timer_active = 1; //indicate frequency timer active minutes_counter = 0; //clear the minutes counter switch (freq_state) { case freq_10: timer_goal = 10; //set timer goal to 10 minutes break; case freq_30: timer_goal = 30; //set timer goal to 30 minutes break; case freq_60: timer_goal = 60; //set timer goal to 60 minutes } P1OUT |= freq_LED; //set frequency LED on P1OUT &= ~dur_LED; //set duration (pump) LED off P1OUT &= ~pump_relay; //turn pump off TACCR0 = 1000; //0 through 62499 cycles TACTL = TASSEL_2 + ID_3 + MC_1 + TACLR; //smclk,divider8,upmode,clrTAR TACCTL0 = CCIE; //enable interrupts for CCR0 _BIS_SR(GIE); //enable interrupts } //*************************************************************** //Timer Interrupt Service Routine // entered every .007 seconds //*************************************************************** #pragma vector = TIMERA0_VECTOR __interrupt void CCR0_ISR (void) { if (++half_seconds_counter >= 73) //if one/half second is up { half_seconds_counter = 0; //clear the half/seconds counter P1OUT ^= freq_LED; //toggle the freq led if (freq_timer_active == 0) //if the duration timer is active { P1OUT ^= dur_LED; //toggle the duration led } if (++seconds_counter >= 120) //if one minute is up { seconds_counter = 0; //reset seconds counter if (++minutes_counter >= timer_goal) //and if timer is complete { minutes_counter = 0; if (freq_timer_active == 1) //and it was the frequency timer { freq_timer_active = 0; P1OUT |= pump_relay; //turn on the pump switch (dur_state) { case dur_5: timer_goal = 5; //set timer goal to 5 minutes break; case dur_10: timer_goal = 10; //set timer goal to 10 minutes } } else //must have been duration/pump timer is now complete { set_freq_timer(); //start frequency timer again } } } } } water pump circuit.doc water pump code.doc
  11. nickey

    Hi all from Spokane WA !!

    thanks, I have the voltage reg working now.. used an LM317 circuit.
  12. nickey

    OK, in deeper water now...

    On my current project I am trying to get the MSP430G2211 to turn on a 12 volt pump for a certain duration. I have all the other logic and coding worked out and done, but I am at an intersection as to how to convert the 3v out signal to control the pump. (see diagram attached).. Do I use some transistor to hit a Power MOSFET (I have an IRF510) and then use that to activate the relay (not sure on how to configure that).. Or do I use the IRF510 or something similar instead of a relay? (never used a MOSFET for anything before).. Or perhaps a better idea yet? thanks.. water pump.doc
  13. nickey

    C coding help needed for new project

    infrared, thanks for the interest.. I am making a "live-well aerator control system" for my fishing boat. When I take my boat to Minnesota each year (where I grew up) one of the more popular baits are a variety of live minnows. When I am up at a lake for a couple of weeks, the tendency is to leave the minnows in the boat's live tank overnight along with any late caught fish that I didn't want to clean that night. Rather than leave the tank pump on all night and drain my boat battery, I wanted a way to have the pump come on at selectable times and durations. I first looked at timer chips and op amps and a lot of discrete components, but someone suggested a micro-controller for the job and I looked into it and it seems like a better approach. I have it working on my breadboard except for the voltage regulator and I would like to see if I can make a simple LM117 or LM317 work for me. Going to radio shack today to see if I can find one.
  14. nickey

    Hi all from Spokane WA !!

    Thanks Geekdoc, I'm sure there are a few of us old players around. My continued amazement is how fast the industry grew and how complex computers are now in everyone's hands including 2 year olds. Its fun to have a circuit and program development environment back in my hands. I'm looking forward to finding new things to make. Before I came to micro-controllers recently, I made lighthouse (to scale) replicas out of wood and mounted on stone and then made an internal battery powered circuit with an LED to simulate a beacon light fading on and off to look like it was rotating.. Then I made a few jewlery boxes for my granddaughters that sprang to life with 8 colored LEDs inside blinking independently (used an op-amp and counter chip). Now I am completing an aerator pump working off of two 3 position rotary switches and driving a relay and LEDs with the MSP430G2211 chip. Still working on the input voltage to regulate 12v lead-acid to 3.3v, but everything else seems to work.
  15. nickey

    Loading final (non-debug) code to chip

    Thanks for the note about the thumbs up.. I was wondering how that worked.
×