Welcome to Cockpitbuilders.com. Please login or sign up.

May 06, 2024, 07:46:06 PM

Login with username, password and session length

PROUDLY ENDORSING


Fly Elise-ng
377 Guests, 0 Users
Members
Stats
  • Total Posts: 59,641
  • Total Topics: 7,853
  • Online today: 554
  • Online ever: 831
  • (May 03, 2024, 12:39:25 PM)
Users Online
Users: 0
Guests: 377
Total: 377

COUNTDOWN TO WF2022


WORLDFLIGHT TEAM USA

Will Depart in...

Recent

Welcome

Relay causes bad readings

Started by kurt-olsson, September 23, 2018, 01:12:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kurt-olsson

Ok, thought i had a ground problem but i checked everything. =(

I have a 2 Channel relay that i switch on/off.

but when i switch it on i get changed values from my potentiometers! This is driving me nuts.

So basically when i set my parking brake my throttles increases from idle to full throttle position!

Do i have a bad relay? or is this some kind of interfering.

Using the Teensy other Ground the values dont jump that much, but still have this problem.


Any input is very welcome.

kurt-olsson

Hm... it might be some voltage drop that is giving me a hard time.

I will try to power the relay with my external 5v instead, that should do the trick.

mickc

How are you driving the relay?  Hopefully not directly with one of the Teensy output pins??

kurt-olsson

#3
Quote from: mickc on September 23, 2018, 10:10:18 PM
How are you driving the relay?  Hopefully not directly with one of the Teensy output pins??

Yes, thats exactly what i did.
5V output from the Teensy and GND from the Teensy.

Worked axcept that i get voltage sink when activating the relay.

My plan is to drive it from my 5V PSU instead to the JDC VCC pin and also hook up Teensy 5V. That should give it stable voltages all the time. At least i think so. =)



mickc

Pretty sure that will still be too much load on the Teensy pin.  It's definitely why you are having issues, and will probably burn out the teensy soon.

You should use a logic level relay board or switch it with a transistor.

Don't forget to put a diode across the coil of the relay too.

Sent from my Pixel 2 using Tapatalk


kurt-olsson

#5
Problem still the same.

I dont understand this. If my relay is fed with 5v feom a 30amp PSU. Why on earth does my teensy drop in voltage?

The relay should allrady have the power needed without my teensy dropping in voltage?

In my world only signal data sjould go from teensy to my relau.

KyleH

Would help if you posted a schematic of your circuit.
You need a proper transistor drive to the relay. It is possible that the previous attempts have damaged the output circuitry on the teensy due to too much current being driven through it.
Kyle

Chief Pilot
Worldflight Team USA
http://www.worldflightusa.com

737NGer

Not my field of expertise, but why don't you connect the output of your teensy to a non-inverting-amplifier, then the output of the amplifier to either your mosfet or relay?

kurt-olsson

Yeah, a ULN2803A or Mosfet will solve this problem easily.
But i dont like it when i dont understand. :)
With external powersupply i cant see how dual channel relay can drop that much voltage. :)

kurt-olsson

When i am using just one relay its kind of ok but i can see a smaaaaal voltage drop. This makes my analogReaders useless.
I dont want one value if relay is active and other if not. hahaha

I am switching to an ULN2803A and a Mosfet for backlighting.
The relays that i have is overkill for the amps that i am using in my tiny lamps...

KyleH

Quote from: kurt-olsson on September 24, 2018, 10:19:46 AM
....
But i dont like it when i dont understand. :)
With external powersupply i cant see how dual channel relay can drop that much voltage. :)

Post you're schematic and I'll see if I can explain. I did microcontroller circuit design in my last job.
Kyle

Chief Pilot
Worldflight Team USA
http://www.worldflightusa.com

RayS

Are you setting the Aref on the Teensy? That input ensures that pot outputs don't change with external voltage fluctuations.

I could be wrong, but that is my understanding of how Aref works.

Here's a good article that explains it better: Basically, if you aren't setting Aref, your AnalogReads() will be useless.
https://tronixstuff.com/2013/12/12/arduino-tutorials-chapter-22-aref-pin/
Ray Sotkiewicz

757Simulator

I'll be honest I have no idea what a Teeny is but as MickC stated:

1. You had better be placing a diode across (1N4007) the terminals of the motor

And 2. I would recommend a solid state relay such as the Kyoto KF0602D very cheap on Amazon.

Mitch

kurt-olsson

The solutionbis like ray point AREF. I will try to use internal low voltage first before trying external.

I remember now i had exact same problem last time with my pots but smaller jitter in values.

Without a stable voltage i can never be sure of my readings.
When thought about it ladt night, relay or other components i cant know the voltage drop so i was worried that analog read is useless combined with other components in my circuit.

ARef seems to be the solution to this.

But i will anyway use a mosfet module, the reelay is for more higher amp stuff that is overkill for my purpose.

Thanks for all help, i might have some time tonight and i will report back.

But atleast now i understand how it works and the controller have a workaround for this problem.

737NGer

Just a guess though, that voltage drop would probably be caused by a reverse emf, assuming the impedance of whatever you're powering doesn't change significantly upon startup?

kurt-olsson

Time to take a loooong pause from my cockpit building.

Bought a Mosfet Module for the Arduino.

The module is turned on and with my voltmeter i can read 12v output, but when connecting my lamp = no light.

The mosfet is an IFR520. Some people say you cant use it but lots of tutorials with my setup.

https://www.kjell.com/se/sortiment/el-verktyg/arduino/moduler/luxorparts-mosfet-modul-for-arduino-p90631#ProductDetailedInformation

kurt-olsson

The IFR520 cant switch on low current.

Why does it say its compatible with Arduino when its not!

kurt-olsson

Fried two teensy controllers and nothing works.

No more cockpit building for a month!!!

Se you all 25th of october!

kurt-olsson

#18
Back again!
Now everything works!

ULN2803A FTW!
Will never use a relay or mosfet again!

skyline223

Please expand on your solution when you get a chance. I too was going to use a Arduino relay module to control the trim motor in my throttle, but now it seems that will not work?
The Boeing 727 Legacy Project
www.727simulator.com

kurt-olsson

Of course. Will put a report later in this thread :)

kurt-olsson

#21
Report:

1. The reelay i used is prob not logic level. It demands "high" voltage to switch on/off.
Using external 5v did not help and my teensy dropped volt and my analog readings where not accurate

2. The IRF520 (Mosfet module) dont work with low level even lots of vendor say its arduino stuff. If i connected 5v direct to the signal it could light the bulb and the output worked. But for PWM and analog write from a signal pin it did not work.

3. AnalogRead problem. This is still a problem with ULN2803A, when measuring voltage across my teensy when light is on compare to off it goes from 4.97 to 4.99v. So there is a small drop here aswell. Dont know if it is noticable to readings but i need a fix for this as i will drive 2 motors aswell in this circuit.

To solve this, you can use external stuff like a regulator but i will investigate the teensy AREF that support low 1.1V for readings. This means that my load dont drop voltage that much so 1.1V will always be stable for reading in my circuit.

End of report. :)

paulnd

#22
I understand your frustration.

My WIP cockpit is driven mostly by Arduinos and after first wiring them based on location (overhead, throttle, MIP etc), I've now rewired based on function, so one Arduino drives relays only, another drives LEDs, another analogue inputs etc, it also make the coding a bit easier for me but I recall that you're a professional programmer so that won't make much difference to you.

I've used opto-isolated relay modules as added protection.

There are IR"F" and IR"L" 520 modules, the "L" type appear to be logic level and a lower max threshold therefore better suited to Arduino/Teensy.

This may be helpful: http://www.gammon.com.au/motors Nick Gammon's forum has been an invaluable resource on my Arduino journey.

Paul

kurt-olsson

Thanks Paul, thats very interesting reading in your link!

RayS

I think the Teensy is best served with a true Aref voltage that's external and does nothing more than supply a reference voltage. Using a reference voltage that comes from a device that relies on a reference voltage is only asking for trouble. :-)

(Make sure you connect the grounds to the same plane.)

As to the voltage drop issue, I think that is normal behavior. Any device that drives another device is going to experience at least a small voltage drop.

Going to the 2803 was a great decision. I keep a box of them handy for any Teensy emergency that might come up.. :-)
Ray Sotkiewicz

Like the Website ?
Support Cockpitbuilders.com and Click Below to Donate