Go Down

Topic: Controllino gives 9v for digitalwrite(LOW) (Read 259 times) previous topic - next topic

obucklin

Hello,

I just got a Controllino Mini, and I'm trying some basic programs to get used to it. I tried running this code which was a built in Controllino example:

Code: [Select]
#include <Controllino.h> 

void setup() {
 
  // lets initialize CONTROLLINO_D0 - CONTROLLINO_D3 as output pins
  // please note that they are mapped to microcontroller´s port D and pins PD4, PD5, PD6 and PD7
  DDRD = DDRD | B11110000;  // safe way how to set register bits 7,6,5,4 of the port D to "1" in one shot and do not influence bits 3,2,1,0
  // logical "1" (HIGH) in the "direction" register configures the appropriate pin as an output
 
  // The same configuration done pin by pin looks like this
  DDRD = DDRD | B10000000;  // Port D, pin 7 is configured as output - corresponds with Digital Output 3 of CONTROLLINO MINI
  DDRD = DDRD | B01000000;  // Port D, pin 6 is configured as output - corresponds with Digital Output 2 of CONTROLLINO MINI
  DDRD = DDRD | B00100000;  // Port D, pin 5 is configured as output - corresponds with Digital Output 1 of CONTROLLINO MINI
  DDRD = DDRD | B00010000;  // Port D, pin 4 is configured as output - corresponds with Digital Output 0 of CONTROLLINO MINI
}

// the loop function runs over and over again forever
void loop() {
  PORTD = PORTD | B11110000;  // sets Digital Outputs 0,1,2,3 in one shot to HIGH -> turns the LEDs ON
  delay(1000);                // wait for 1 second
  PORTD = PORTD & B00001111;  // sets Digital Outputs 0,1,2,3 in one shot to LOW -> turns the LEDs OFF
  delay(1000);
  PORTD = PORTD | B00010000;  // sets Digital Output 0 to HIGH -> turns the LED ON
  delay(1000);                // wait for 1 second
  PORTD = PORTD & B11101111;  // sets Digital Output 0 to LOW -> turns the LED OFF
  delay(1000);
  PORTD = PORTD | B00100000;  // sets Digital Output 1 to HIGH -> turns the LED ON
  delay(1000);                // wait for 1 second
  PORTD = PORTD & B11011111;  // sets Digital Output 1 to LOW -> turns the LED OFF
  delay(1000);
  PORTD = PORTD | B01000000;  // sets Digital Output 2 to HIGH -> turns the LED ON
  delay(1000);                // wait for 1 second
  PORTD = PORTD & B10111111;  // sets Digital Output 2 to LOW -> turns the LED OFF
  delay(1000);
  PORTD = PORTD | B10000000;  // sets Digital Output 3 to HIGH -> turns the LED ON
  delay(1000);                // wait for 1 second
  PORTD = PORTD & B01111111;  // sets Digital Output 3to LOW -> turns the LED OFF
  delay(1000);
 
 
  // please, visit https://controllino.biz/downloads/   
  // if you want to know more about the mapping of the CONTROLLINO
  // digital outputs to the microcontroller´s ports and pins
}

/* End of the example. Visit us at https://controllino.biz/ or  https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library or contact us at info@controllino.biz if you have any questions or troubles. */

/* 2016-12-14: The sketch was successfully tested with Arduino 1.6.13, Controllino Library 1.0.0 and CONTROLLINO MINI. */


Everything seems to work fine on USB power. The Pinheader is giving normal 0-5v switching. Howerver, when I attach a 12v power supply, the digital output pins switch between 12v for HIGH and about 9v for LOW. I can hear the relays switching normally, and the LED continue as if normal. I'm reading the voltage with a multimeter across input GND and the DigitalOut pin. Any ideas?

Thanks!!

MorganS

The core processor chip cannot tolerate 12V or 9V. It cannot ever have that voltage between any pin and its ground pin. If it did, it would overheat and explode.

Since you did not say you had witnessed any explosions, we can rule out that possibility.

It seems more likely that you did not connect the ground properly.
"The problem is in the code you didn't post."

larryd

Show us a good schematic of your circuit.   
Show us a good image of your wiring. 
Posting images: 
https://forum.arduino.cc/index.php?topic=519037.0     


No technical PMs.
The last thing you did is where you should start looking.

obucklin

Hello,

Thank you very much for the response.

Here is the Power Adapter, which I suspect could be the problem:



Here's the wiring. The red wire measures to 5v, and the blue to 12v. I also tried including the loose ground wires sticking out to the left and I got the same results:



The voltage measures 12v at the input:



and the blink routine gives these results...



I will root around and see if I have another power source, but if you see any glaring problems I would appreciate the help. Thanks!!


FredScuttle

#4
Jul 10, 2018, 06:21 am Last Edit: Jul 10, 2018, 06:41 am by FredScuttle
The user guide says the outputs are "high side switches", have you tried with a load resistor of, say 220 Ohms and 1 watt connected  from D0 to GND (or CMN)? Have you read the user's guide (page 17)?
https://controllino.biz/wp-content/uploads/2018/05/CONTROLLINO-Instruction-Manual-V1.2-2018-04-23.pdf
Awww! Who needs an instruction manual to use a simple chain sa......

obucklin

Hi

Thanks for the reply. Sorry I'm a little unclear about the operation of high-side switching/transistors. Is it normal that a high-side switch would still read high(9+v) like that with a digitalWrite(LOW)? If current is restricted in the LOW state, then a simple resistor should drop the voltage to an acceptably low level, right?
I have to drive a frequency controller for an AC motor with it, which will ultimately require a 24v signal. Am I likely to experience the same effect at 24v?

Thanks!

FredScuttle

#6
Jul 10, 2018, 10:44 pm Last Edit: Jul 10, 2018, 10:56 pm by FredScuttle
A high side switch can only "source" current, it cannot "sink" (conduct current to ground).
What you are seeing is leakage current through the switching transistor, with an open circuit between output and ground (CMN ?) that leakage current has nowhere to go except through your high impedance meter circuit, thats why you see voltage on the meter, (not a true voltage but the effect of the tiny leakage current), try a 10k pulldown resistor first and see if it pulls the "OFF" voltage down below about 0.2V, if not try a smaller R, but I wouldn't go below about 2.2K, (wasting power). Also the pulldown has to have a high enough wattage rating not to overheat (0.26 Watts for 2.2k at 24V) when the output is HIGH.
P (Watts) = Volts * Volts / R.
Awww! Who needs an instruction manual to use a simple chain sa......

obucklin

Great! thank you FredScuttle for the explanation. Very helpful

Go Up