I'm trying to use Teltonika FMB920's Digital output HIGH/LOW as an input for an Arduino Nano to perform a certain state in an autonomous aircraft.
The problem I've encountered is that the digital output from the GPS/GSM module is weak, around 7mV when connected directly to one of the Arduino's pins. I've also tried to fool the module's power-saving feature by attaching a dummy 100k resistor to the digital output, which did manage to bring the signal up to 40mV while running at around 20mA. But that is still not detectable by the Arduino.
So far I've researched using opAmps, comparators to bring up the voltage into the detectable range of the Arduino. And this is what i'm not sure about:
Though they could solve my issue, I am not sure about the reliability of the signal I'd be getting after amplifying it as there could be a lot of EMF noise attributing to probable false positives (could be fixed in software)
I'd probably require another power source to get the Vref, which would add to the complexity, weight, reliability problem
Not as power efficient as it could be
I was running the Arduino at 5v through USB for testing, but it will be operating at 3.3V which should make the 10bit ADC's resolution better, but the logical HIGH is still at 60% of the Vcc which, is around 2V, I'd like to bring that signal to around 2.8V-3V to be safe.
As I am not really an expert in electronics, I've been stuck with this issue for a couple weeks now, Googling and reading.
Maybe there is a better way to do this, or am I getting something wrong? The datasheet for the GPS/GSM module can be found here
I've already tried the INPUT_PULLUP option with my Arduino Nano, but then it always pulls the voltage to logic HIGH even when there is no signal on the digital out.
The term "Open Drain Grade" did confuse me, i think they meant "Open Drain Gate"?
Forgot to mention that in the original post.
PE -- "but then it always pulls the voltage to logic HIGH even when there is no signal on the digital out."
All of the time? At some point it should go Low. Is this a case where the presumption is "Low == Off, High == On"?
I have a simple idea that might work. Maybe you could use an optocoupler. Attach the LED side from Vbat to Din (don't forget a resistor), and hookup the other side from 3.3V to an Arduino analog pin.
That way, when Din sinks current, the LED in the optocoupler turns on, which in turn switches the output transistor on, which allows 3.3V to go to the Arduino analog pin.
You need a resistor up to your Arduino 5v ( say 10k) , other end connected to the output pin of the device . Then take the same output pin to your Arduino digital input pin .
Make sure you have a common 0v line
Don’t forget to set pinMode as an INPUT in your sketch .
I can control the output pin of the GPS/GSM module through software, and it switches between 0V, and 7mV (or 40mV when there is a load on the pin), but the switch just says ON/OFF.
I've made a simple script that lights up the builtin LED when there is a detected HIGH on the Arduino pin, and also print the state to serial.
When I put the modulePin as INPUT_PULLUP the val and ledState default to HIGH, while if i just put the pin into normal INPUT, it is always LOW. In both cases toggling the DOUT pin on the module doesn't change the val state.
Has to work ! Check the output value with a DVM whilst connected to the resistor/output connection to see if it changes hi/lo . If not either the output is now dead or configured incorrectly .
Or even just wire an led with a 1k resistor to the output and power supply +. That will definitely highlight where the problem is.
You can also connect the Arduino pin to 0v or 5v aand see what you can read (( hope you aware not using 0or 1 as input )
That's what I thought, I've already tried powering on an LED with it the same way you've described, to me it made sense, but it did nothing except raising the voltage from 7mV to 40mV@20mA once i put the load on. But the pin Dout pin correctly switches from 0v (OFF) to 7-40mV(ON).
I've used the right pins on the Arduino.
I could draw/take a picture of the whole circuit in around 6hours.
But i guess as Leo said in the beginning, there is no way to power stuff up because this Dout pin is most probably an Open collector which should behave like a solid state relay which requires an external power source to power any load as this Dout just acts like a switch to ground for the power source...
Which makes sense considering that this device is sold primarily for cars.
I was just hoping that there was a way to pull this low voltage state to a high enough signal that Arduino can read it as HIGH/LOW afterwards, and execute some code.
The documentation wasn't really the clearest to me, regarding this pin.
Wot open drain looks like . When active the output line of your device connects to 0v through the FET . There is no voltage output , just regard it as a switch
Thank you for the responses @kgray9 and @hammy.
I will try it out in a couple hours.
Though this is what the Arduino should be doing, by pulling it up to 5V when i set the pinMode(modulePin, INPUT_PULLUP) and when i do, Arduino always gets HIGH regardless of the GPS's Dout state, it can be ON/OFF, and the Arduino always gets HIGH on it's input.
It would only do that if your 0v lines are not connected between power supply Arduino and your device or something is dead . As said check with an led , voltmeter etc
Need a diagram of how you have wired this . You earlier mentioned V- what is that ?