Netduino home hardware projects downloads community

Jump to content


Photo

Driving relay coils using a Netduino


  • Please log in to reply
No replies to this topic

#1 Dr Who

Dr Who

    Advanced Member

  • Members
  • PipPipPip
  • 261 posts
  • LocationNYC

Posted 27 April 2016 - 01:32 PM

Hello!

New project time here. Right now I have running a Netduino using an edited form of one of my PAL driver programs to talk to an SN7437 wired to send the output of the first gate to go to the second's first input. There's also a red LED attached to first's output. The one for second is connected to a SSR who's activating the 24V coil in the counter.

Here's my code:

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace palout4
{
    public class Program
    {
        public static void Main()
        {
            // write your code here
            OutputPort i0 = new OutputPort(Pins.GPIO_PIN_D2, false);
         //   OutputPort i1 = new OutputPort(Pins.GPIO_PIN_D3, false);
         //   OutputPort i2 = new OutputPort(Pins.GPIO_PIN_D4, false);
         //   OutputPort i3 = new OutputPort(Pins.GPIO_PIN_D5, false);
         //   OutputPort i4 = new OutputPort(Pins.GPIO_PIN_D6, false);
         //   OutputPort i5 = new OutputPort(Pins.GPIO_PIN_D7, false);
         //   OutputPort i6 = new OutputPort(Pins.GPIO_PIN_D8, false);
         //   OutputPort i7 = new OutputPort(Pins.GPIO_PIN_D9, false);
          //  OutputPort i8 = new OutputPort(Pins.GPIO_PIN_D10, false);
         //   OutputPort i9 = new OutputPort(Pins.GPIO_PIN_D11, false);
         //   OutputPort i10 = new OutputPort(Pins.GPIO_PIN_D12, false);
         //   OutputPort i11 = new OutputPort(Pins.GPIO_PIN_D13, false);
            while (true)
            {
                i0.Write(true);
             //   i1.Write(true);
             //   i2.Write(true);
             //   i3.Write(true);  
             //   i4.Write(true);  
             //   i5.Write(true);  
             //   i6.Write(true);  
             //   i7.Write(true);  
              //  i8.Write(true);  
         //       i9.Write(true);
                Thread.Sleep(1500);
                i0.Write(false);
            //    i1.Write(false);
            //    i2.Write(false);
            //    i3.Write(false); 
            //    i4.Write(false);
            //    i5.Write(false);
            //    i6.Write(false); 
            //    i7.Write(false); 
          //      i8.Write(false);
          //      i9.Write(false);
             Thread.Sleep(1500);
                i0.Write(true);
              //  i1.Write(true);
              //  i2.Write(true);
              //  i3.Write(false);  
              //  i4.Write(false);
              //  i5.Write(false); 
              //  i6.Write(false); 
              //  i7.Write(false); 
         //       i8.Write(true);
         //       i9.Write(true);
              Thread.Sleep(1500);
                i0.Write(true);
          //      i1.Write(true);
          //      i2.Write(true);
          //      i3.Write(false); 
          //      i4.Write(false); 
          //      i5.Write(false); 
          //      i6.Write(false); 
          //      i7.Write(false); 
         //       i8.Write(true); 
         //       i9.Write(true);
         //       i8.Write(false);
         //       i9.Write(false);
             Thread.Sleep(1500);
                i0.Write(false);
         //       i1.Write(false);
         //       i2.Write(false);
         //       i3.Write(false);
           //     i4.Write(false);
          //      i5.Write(false);
          //      i6.Write(false);
          //      i7.Write(false);
          //      i8.Write(false);
          //      i9.Write(false);
             Thread.Sleep(1500);
               i0.Write(true);
           //    i1.Write(true);
           //    i2.Write(true);
           //    i3.Write(false); 
           //    i4.Write(false); 
           //    i5.Write(false); 
           //    i6.Write(false);
           //    i7.Write(false); 
         //       i8.Write(true);
         //       i9.Write(true);
             Thread.Sleep(1500);
                  i0.Write(false); 
         //       i1.Write(false);
         //       i2.Write(false);
         //       i3.Write(true);
         //       i4.Write(true); 
         //       i5.Write(true);
         //       i6.Write(false);
         //       i7.Write(false);
         //       i8.Write(false);
         //       i9.Write(false);
              Thread.Sleep(800);
              
            }
        }
    }
}

I'm keeping the format that I found worked for the earlier efforts, however it's the driving circuits that I'm stuck on. That one I described is the first one I tried. So naturally it worked.

 

Oddly enough the circuit refused to work with a Basic Stamp2 device.



Doctor Who
"This signature does not exist!"




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.