Netduino home hardware projects downloads community

Jump to content

The Netduino forums have been replaced by new forums at This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.


Member Since 19 Nov 2013
Offline Last Active Oct 04 2016 01:34 AM

#65207 Ham Radio Repeater Controller

Posted by vader7071 on 16 June 2016 - 12:29 AM

I am interested in making a repeater controller for my ham radio gear,


I have a Netduino 1.  The way this woks, I will have 2 radios connected to this "controller".  Radio 1 and Radio 2


When radio 1 receives a signal, the controller will key up the transmit on radio 2 and the audio from radio 1 will be sent into the "mic" of radio 2.


Then when radio 2 receives a signal, the controller will key up the transmit on radio 1 and the audio from radio 2 will be sent into the "mic" of radio 1.


There are more safeties and controls that need to be added, but that is the general premise.  Has anyone tried this before? 

#58295 trying to flash an LED and pluse a piezo in error state

Posted by vader7071 on 20 May 2014 - 08:06 PM


The alarm test code works!

Here is the latest version:
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace alarm
    public class Program
        //IO pins
        static InputPort fakeConnection = new InputPort(Pins.GPIO_PIN_D0, false, Port.ResistorMode.PullUp);
        static OutputPort led = new OutputPort(Pins.GPIO_PIN_D6, false);
        static OutputPort led1 = new OutputPort(Pins.ONBOARD_LED, false);
        static OutputPort led2 = new OutputPort(Pins.GPIO_PIN_D1, false);
        static PWM piezo1 = new PWM(Pins.GPIO_PIN_D5);

        static int i = 0;               //counter
        static int critical = 4;        //number of fails to trigger alarm
        static uint tone1 = 1000000 / 212 ; //212 Hz is middle c
        static uint tone2 = 1000000 / 300; //212 Hz is middle c

        public static void Main()
            //Stop the piezo so it's not buzzing when the program starts
            piezo1.SetPulse(0, 0);
            while (true)
                //If connection is good
                if (fakeConnection.Read() == true)                     //true = within range, false = out of range
                    i = 0;                          //remotely written overriding count below

                ++i;                                //Increase counter by 1

                if (i > critical)                   //if connection is broke, counter will go above 1, when counter hits value in critical, set alarm
                    while (i > critical)            //set alarm led
                        piezo1.SetPulse(tone1, tone1 / 2);  //set alarm piezo
                        led.Write(!led.Read());     //Toggle the LED by setting it to the opposite of its current state
                        piezo1.SetPulse(tone2, tone2 / 2);  //set alarm piezo

                        //Check to see if we're still in an alarm state
                        if (fakeConnection.Read() == true)
                            i = 0;

                    //The alarm has stopped
                    piezo1.SetPulse(0, 0);
                Thread.Sleep(200);                  //loop sleep for 200 ms
For now I am happy. When I press the button, I go into alarm state, the LED flashes, and the piezo pulses between 2 tones.

I already know what I will want to do next. Next step will be to split the LED flash and the piezo tone into 2 (I am assuming) interrupts so I can control the flash rate and the tone change independently of each other.

But hey, I am STOKED I am this far already.

knut.tveitane, as oyu can see, I went ahead and used the ++i and that seemed to work.

There is going to be another stage in the alarming section, but the big part was getting the total loss to work. Next step is going to be an intermittent setup.

#55579 Controlling more than 1 Max7219 (goal is 6)

Posted by vader7071 on 23 January 2014 - 03:20 PM

Ok, here is a copy of the files I am using in a txt format.   First off.  Thank you to Paul Newton on the forum and to Paul from Baltimore Hackerspace.  (Yeah, I thought the same thing until I realized P. Newton is from the UK).  These 2 gentlemen have been so patient helping me solve this problem and have taught me so much.   Now, onto the solution.  I realize this in not the "end all be all" solution.  There are probably more ways to do this, and I am sure I will learn them in time, but this is what I have now.   Finding code to control 1 Max7219 was fairly easy.  I did notice a common thread though.  Most every successful max7219 program had an external file called max7219.cs (or some variant there of).  This external file setup the chip and setup the spi configuration.  But we are not talking about 1 chip here, we want more.   So with the help of the Pauls, here is what I have.   Setup.  I am running multiple max7219 chips to an 8x8 led grid.  Here is what I am using.   program.cs is the guts.  This is where you make the display you want.  max7219.cs is the chip driver.  Without this file, it won't work.   Notes in max719.cs first.  To run multiple chips, there is a section titled "maxDouble".  Looks like:  
// Sends 1 Command / Data pair to two driver chips   public void maxDouble(byte reg1, byte col1, byte reg2, byte col2)      {         // LOAD low         loadPin.Write(false);          // Transmit Register 1         putByte(reg1);         // Transmit Column 1         putByte(col1);         // Transmit Register 2         putByte(reg2);         // Transmit Column 2         putByte(col2);          // LOAD high latches data sent         loadPin.Write(true);      }
You have to have a reg and a col per chip.  So, if you wanted to run 5 chips, there would be a reg1, reg 2, reg 3, reg 4, reg 5 plus the additional lines below making reg 1-5.  Same for col.  This is the first part of controlling multiple chips with different data on each.   Ok, we have made the changes to max7219.cs, now on to program.cs. In program.cs we have 2 areas to look at.  First is near the bottom and says:  
for (v = 0; v < animations[animation_num][0].Length; v++)   {      driver.maxDouble         (            (byte)((v % 8) + 1), animations[animation_num][1][v], //chip 2 (end of line)            (byte)((v % 8) + 1), animations[animation_num][0][v]  //chip 1 (closest to Netduino)         );      Thread.Sleep(10);  // delay set to write next column   }
This is setup for 2 chips.  If we go to the 5 discussed earlier, you will modify it to the following:  
for (v = 0; v < animations[animation_num][0].Length; v++)   {      driver.maxDouble      (         (byte)((v % 8) + 1), animations[animation_num][4][v], //chip 5 (end of line)         (byte)((v % 8) + 1), animations[animation_num][3][v], //chip 4         (byte)((v % 8) + 1), animations[animation_num][2][v], //chip 3         (byte)((v % 8) + 1), animations[animation_num][1][v], //chip 2         (byte)((v % 8) + 1), animations[animation_num][0][v]  //chip 1      );      Thread.Sleep(10);  // delay set to write next column   }
  (notice the change in count from 4 to 0?  That is how we are addressing the chips).   This is the only modification to be done in this area.  You only change here if you are wanting to have more than 2 chips from the example supplied.  Notice though that the chips count from the last chip in the line to the closest chip to the Netduino.  That is key and will be referenced below.   the sleep command is what slows the counting process down.  Increase the value, the update time is slower, decrease, the leds move faster.  the time is in milliseconds.   Now that is all the setup.  But we still don't have our "pretty".  Here is the pretty.  Going back up in the code, there is a section that starts:   byte[][][] animations = new byte[][][]   This is where the pretty is stored.  The reason for 3 sets of brackets is to allow for more than one "pretty".  I won't go into too much detail here, but hopefully as I explain what is where you will see what is going on.   The code:  
byte[][][] animations = new byte[][][]   {      //Annimation index 0      new byte[][]      {         //Chip 1 output (closest to Netduino)         new byte[]         {            0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,            0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01         },          //Chip 2 output (end of line)         new byte[]         {            0xff,0xfe,0xfd,0xfc,0xfb,0xfa,0xf9,0xf8,            0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe         }      }   };
  (now this is extremely simplified).   Each row is 8 bytes long.  Each hex value controls one column of lights.  So to control the whole grid, I have to send 8 hex values total.  0x00 = no lights, 0xff = all lights in a column.  the lights count in binary 1 being the highest led and 128 being the lowest led. One comment about this. Both bytes MUST be the same length. If you are showing something on chip 2 but want chip 1 blank, you MUST send 0x00 as long as you are sending something to chip 2. If they are different lengths, it will fault the program.   The attached code currently scrolls "VA" across 2 displays.  I am in the process of expanding it to say "VADER RULES!" but as you can see, that will take time.  I am sure there are better ways to do it, in fact I am almost positive, but I am learning myself, and this is helping me to better understand what is going on.   Upcoming updates for this for my uses, multiple scrolling messages.  I will have "VADER RULES!" and then have it setup to output random values so the leds just flash and then have it set so the random is running and then every so often, "VADER RULES!" scrolls across and back to random flashing.

Attached Files

#55146 Detect Dry Contact Closure

Posted by vader7071 on 02 January 2014 - 10:27 PM

Try this.  I used it to send a PWM signal, but you can see how the interrupt works.

using System;using System.Threading;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using SecretLabs.NETMF.Hardware;using SecretLabs.NETMF.Hardware.Netduino; namespace Auto_Shut_Off_Box{    public class Program    {        static PWM servo = new PWM(Pins.GPIO_PIN_D5);        static uint firstPosition = 1000;        static uint lastPosition = 2100;         public static void Main()        {            // write your code here            InterruptPort button = new InterruptPort(Pins.GPIO_PIN_D0, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);            button.OnInterrupt += button_OnInterrupt;             servo.SetPulse(20000, firstPosition);             Thread.Sleep(Timeout.Infinite);        }         static void button_OnInterrupt(uint data1, uint data2, DateTime time)        {            if (data2 == 0) // 1 == rising edge, 0 == falling edge            {                // Rising Edge                servo.SetPulse(20000, lastPosition);            }            else            {                // Falling edge                servo.SetPulse(20000, firstPosition);            }        }    }}

#54873 Autonomous R2D2

Posted by vader7071 on 24 December 2013 - 04:40 PM

Here is some of the dome work I have done.  Whatcha think?

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.