Netduino home hardware projects downloads community

Jump to content


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

Driving 5v Relay and False Interrupts


  • Please log in to reply
13 replies to this topic

#1 theaccent

theaccent

    Member

  • Members
  • PipPip
  • 12 posts

Posted 02 May 2015 - 12:01 AM

Hi All,

 

I have a home made projector lift which I'm controlling with the Netduino.  The control has 2 methods, infrared sensor and manual override.  Each method will have 3 controls each (Up, Stop and Down).  The lift actuator is driven by a relay shield

 

http://www.ebay.com....RK:MEBIDX:ITTheoutputs will be to solid state relays.

 

All the coding worked, cleaned up some bouncing with the manual switches and tested it with the actuator all works well.

 

The problem I have occurs when I try to control the screen, the receiver module for the screen has an input relay with inputs for Up/Down/Stop/Ground, so I was just going to wire it into the Netduino... but couldn't get it working, turns out they are expecting 5v (4.7v after measuring with the multi meter), what would I need to do to get the the Netduino working with the 5v relay...  transistors? I'm not very knowledgeable on electronics so clear steps would helpful...

 

http://www.motiontec....php?section=02

 

In the mean time while waiting for that solution, I though I'd used the 2 spare relays on the relay shield to control Up and Down on the screen, it is controlling the screen but the output is bouncing all over the place and executing interrupts for different pins (seeing it via debug commands to console) - example the relay output is D5 but it's causing the interrupt to run for D1 and D2.  Any ideas as to why the output would be bouncing so much and hitting other interrupts?

 

My preferred option is to to run the screen from the pins on the Netduino rather than via the relays.

 

Any assistance would be greatly appreciated.

 

I've included a diagram - the 2 diagrams are essentially the same, I've included the Netduino so you can see which pins are being used and then that translates over to the relay shield

 

Thanks again for the assistance....

Attached Files



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 02 May 2015 - 05:43 AM

Hi theaccent,

Let's isolate the different issues for you here...

On relays: if your relays need a 5V signal input, you can consider using a transistor or FET to convert the 3.3V signal output from Netduino to the 5V signal that the relay is looking for. You'll basically just use the 3.3V signal output from your Netduino to activate/deactivate the transistor.

There are also voltage conversion breakouts available from resellers like SparkFun.

On interrupts: are you using a pushbutton as your input? If so, setting GlitchFilter to true may help. Or filtering out any button bouncing in code.

Does that help get you on the right path?

Chris

#3 theaccent

theaccent

    Member

  • Members
  • PipPip
  • 12 posts

Posted 03 May 2015 - 01:39 AM

Hi Chris...

 

Appreciate the quick response...  With the manual switch, I've already been filtering out the bounce using code and as mentioned it works fine when the wires from the screen module are not connected to the relay, I'll give the Glitch filter a go as I currently have them set to false.

 

With the transistor method, is there specific sizes I should get... am I correct in saying the pin of the netduino connects to the base pin, the netduino ground to the emitter to the ground of the relay, the collector to the screen module input?  Is there anything else that should be in there?  Do I need a separate transistor for each input Up/Stop/Down?



#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 03 May 2015 - 04:24 AM

Hi theaccent,

Here's a good primer on hooking up transistors. Your Netduino's signal will go to the base.
http://www.learninga...tch-circuit.php

You will need to size the transistor to deal with the amount of current that you're switching through it. For fast switching and heavy loads, you'll start looking at FETs or H-Bridges.

If you have multiple signal inputs that you're converting from 3.3V to 5V, you might want to grab a signal logic (voltage) level converter breakout. Here's one option from SparkFun: https://www.sparkfun.../products/12009

Chris

#5 theaccent

theaccent

    Member

  • Members
  • PipPip
  • 12 posts

Posted 06 May 2015 - 11:47 AM

Thanks again Chris for the response... I like the look of the Logic Level Converter... one question I had with relation to it is that it requires being powered from the 5v side and the 3.3v side, while the Netduino would provide the power for the 3.3v side, there isn't a corresponding power on the screen relay module...  would this need a separate power source?



#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 06 May 2015 - 07:49 PM

Hi theaccent,

Thanks again Chris for the response... I like the look of the Logic Level Converter... one question I had with relation to it is that it requires being powered from the 5v side and the 3.3v side, while the Netduino would provide the power for the 3.3v side, there isn't a corresponding power on the screen relay module...  would this need a separate power source?

Your Netduino has a 5V power supply and a 3.3V power supply (on the 6-pin blue header), so you should be able to use those to power the logic level converter.

If you're supplying power to your Netduino via USB the 5V header will output the USB input power (somewhere between 4.5V and 5.25V typically). If you're supplying power to your Netduino via AC-DC adapter on its power barrel, the 5V header will output regulated 5V power.

Does that answer your question completely?

Chris

#7 theaccent

theaccent

    Member

  • Members
  • PipPip
  • 12 posts

Posted 13 May 2015 - 12:58 PM

This project is starting to drive me nuts....

 

I'm still trying to get the Netduino to drive the screen...  I ordered the LLC and wired everything up and I still can't get the Netduino to drive the screen.  I've included a diagram to show how I have it wired up (I've removed the relay shield and actuator to bring it back to a single item).

 

I do get interesting behaviour sometimes, when I'm wiring up the LLC or when when the Neduino starts up, it sometimes activates the screen module.

 

I'm a bit lost...  

 

I know it's very hard to diagnose something on a forum....

Attached Files



#8 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 13 May 2015 - 10:37 PM

Hi theaccent,

Can you remove all the wiring except for the wires to the screen...and then we can all help dig into the datasheets with you to figure out how to get that screen to work?

Chris

#9 theaccent

theaccent

    Member

  • Members
  • PipPip
  • 12 posts

Posted 14 May 2015 - 12:14 AM

I don't have a data sheet for the screen module and can't find one on the internet so I've emailed the company to see if they have one...

 

When I get home this evening, I will strip the Netduino down to just the Netduino and the LLC and try to get the screen to activate via the onboard button...  I'll get it to do down, wait for 1 minute then go back up and see how we go...



#10 theaccent

theaccent

    Member

  • Members
  • PipPip
  • 12 posts

Posted 14 May 2015 - 11:45 AM

I stripped the Netduino down to just the Netduino and the LLC to try to get the screen to activate via the onboard button but not much luck.  When the code loaded and the Netduino started up the first time, the screen came down without any interaction.  Some times I could hear the relays ticking over but it it wasn't doing anything to the screen...  

 

I did have a look at the components in the screen module and managed to identify the relays being used 833h-1a-c and found the data sheet for them

 

http://www.mouser.co...287145-4912.pdf



#11 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 14 May 2015 - 05:42 PM

Hi theaccent,

Unfortunately without a datasheet for the screen or a wiring diagram or code, etc...it's going to be really hard to find a good starting point (i.e. needle in a haystack issue) to diagnose.

There are a few paths that you might want to consider to debug the issue:
1. You may want to pick up one or more of the relay parts and get it working in isolation with your Netduino (lighting up an LED, for instance) to understand how it works and to make sure it's working properly.
2. If others have used the part in other projects, you can ping those projects' makers for their experiences on how to power up and use the module.
3. The part may require certain signal voltages or certain amounts of power decoupling, etc. Searching through other projects using the part may yield some clues to this.

Often the difference between something working and not working is a subtle issue. In the end, rebuilding the solution step by step (or measuring the differences between a working project and a non-working project) may be the way to go.

We're here to help. We just need more data to learn how to get this set of parts working.

Chris

#12 theaccent

theaccent

    Member

  • Members
  • PipPip
  • 12 posts

Posted 16 May 2015 - 02:02 PM

So I thought I would provide an update...

 

Been tidying my project up this weekend...  rather that using the LLC, I have a couple of DC - DC Solid State Relays, so I have inserted them between the Netduino and the screen module and I have managed to get the following working....

 

Screen Module and Lift Actuator are working with the infra red receiver, works really well, can call Up Down and Stop with no issues which is really good news.

 

When I wire in the manual override switches is when problems start.  When I send an IR code as above with the manual switches wired in, the Netduino starts executing interrupts for the manual switches, even though they have not been touched.  I did add in software bouncing which worked with the switches in isolation but with the other items in the mix I get problems.

 

These are the switches I am using, Common is wired to Ground and 1 is wired to the Netduino pin.  

http://updates.clips...es/W0000800.pdf

 

What are the recommendations to address this one.... do we use different switches, try to address bouncing or... open to suggestions...



#13 theaccent

theaccent

    Member

  • Members
  • PipPip
  • 12 posts

Posted 17 May 2015 - 05:30 AM

A further update...  disconnected the manual switches and commented out the code and tried using the onboard button to see what behaviour I was getting and the same thing is happening...

 

On a more sad note....  I was tidying things up and was going to just use the infrared to control everything for now, I also added some resistors for a voltage divider to detect the 12v trigger of the projector so the lift doesn't go up when the projector is on (over heating) and I noticed one of the cables wasn't screwed into the terminal shield...  I must have touched it on another pin by accident and blew an LED on the terminal shield and 'fried' my Netduino P2!!

 

SUCKS!

 

Need to now order a new board but will just order a Netduino 2 (no plus) :(



#14 dhensel

dhensel

    New Member

  • Members
  • Pip
  • 7 posts
  • LocationBoston, MA

Posted 26 May 2015 - 04:25 PM

I have been using a similar relay shield, and found it to be very "noisy" electrically.  It would send a large spike that would be picked up on my other channels and more importantly - on my interrupts.  

 

My workaround for this was to create a bool to "lock" my interrupt.  So it would still fire on switch bounce and from the noise, but I'd discard any unwanted ones and "return".

 public void doorClose(OutputPort output)
            {
                //Originally was Open, 3s Close, .5s. Then wait 2s in other call.
                Debug.Print("enable door close solenoid");
                output.Write(true);
                Thread.Sleep(500);

                //Unlock interrupt before door solenoid switches off.
                Debug.Print("Interrupt Unlocked");
                interruptLocked = false;
                
                //Wait for expected interrupt to fire here
                Thread.Sleep(3500);
                

                //Lock Interrupt before door solenoid switches off
                interruptLocked = true;
                Debug.Print("Interrupt Locked");
                Thread.Sleep(1000);

                //Close Door
                Debug.Print("disable door close solenoid");
                output.Write(false);
                Thread.Sleep(500);                
            }

This way, I knew I was looking for the interrupt within a specified period of time - and I didn't allow known  external sources (closing the door via output.Write(false) on the relay shield) to send a valid interrupt.

 static void doorSwitchOK_OnInterrupt(uint data1, uint data2, DateTime time)
        {
            if (control.interruptLocked)
            {
                Debug.Print("++++++++ return, interrupt was locked-------------");
                return;
            }
            //Debounce the switch
            if (DoorButtonLastPushed.AddMilliseconds(500) > time)
            {
                Debug.Print("oooooooo return, switch bounce-------------");
                return;
            }
            //Update last time greater than 500 ms.
            DoorButtonLastPushed = time;

            Debug.Print("-----------door switch button pressed-------------");
            control.keepRunning = true;
        }

The result of this on my debug output would be several lines of noise from the relay shield, then I'd get one line of the desired interrupt, and several lines of switch bounce return, and then several lines of noise again from the relay shield.

 

Not sure if this applies to your case, but if you hook up your outputs to an oscilloscope, I'd guess you would see the relay noise too.

Attached Files






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.