Author Topic: Question about VIN  (Read 4366 times)

atkulp

  • Newbie
  • *
  • Posts: 22
Question about VIN
« on: May 17, 2016, 09:10:39 pm »
Am I right in understanding that VIN is essentially a passthrough of the 5V when you connected to a USB power cord?  It looks like you can power via VIN with a 4.5v-12v source, but I just wanted to confirm that VIN matches the micro USB 5v when powered that way.  Thanks!

PeterF

  • Hero Member
  • *****
  • Posts: 881
Re: Question about VIN
« Reply #1 on: May 17, 2016, 11:51:12 pm »
Vin will pass the 5v from the USB when the Oak is powered via the microUSB port, so yes, you can get the 5v input that way. It looks like it will not reverse-feed the USB port if Vin power is provided, as there is a diode in the path, but I haven't tested it!

atkulp

  • Newbie
  • *
  • Posts: 22
Re: Question about VIN
« Reply #2 on: May 18, 2016, 11:10:39 am »
Thanks.  Does the power source affect the amperage available on the GPIO pins or is it stable?  I need 20A on a pin to drive a relay (http://www.sainsmart.com/4-channel-5v-relay-module-for-pic-arm-avr-dsp-arduino-msp430-ttl-logic.html) and it clicks the relay, yet nothing happens.  I'm assuming it's not enough power to pull it all the way maybe...

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Question about VIN
« Reply #3 on: May 18, 2016, 03:46:39 pm »
I think you meant to say 20mA not 20A. In any case the Oak if a 3.3v device. Your relay likely needs 5V to close the relay. Also you should look for sample schematics for driving a relay from the a GPIO pin. Typically the GPIO pin would drive the base of a suitable transistor which would in turn switch on the voltage/current necessary to drive the relay. You also usually see a diode across the relay coil to absorb the fly-back when the field on the coil collapses when shut off. Should be easy to find a typical circuit for this. I need to leave for an appointment else I would post one for you.

atkulp

  • Newbie
  • *
  • Posts: 22
Re: Question about VIN
« Reply #4 on: May 18, 2016, 04:10:11 pm »
Yes, mA of course!  My previous post linked to the relay board I'm using.  It's not a single relay, so it's already got the diodes, transistors, etc.  I'm getting 5v from VIN while powered by micro USB.

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Question about VIN
« Reply #5 on: May 18, 2016, 05:39:25 pm »
Even though VIN follows the USB at 5V, whatever pin you are using to drive the relay board input is most likely only at 3.3v when HIGH. Plus your board uses opto-isolaters that want 5V. I'm guessing this is why the relay isn't fully engaging. You could do a simple experiment to see if a current limited 5V source will do the trick. Be sure to use a resistor so that you don't burn out the opto-isolaters on the board. A 270 or 330 ohm resistor should do the trick and limit a 5V source to 15-18mA.

PeterF

  • Hero Member
  • *****
  • Posts: 881
Re: Question about VIN
« Reply #6 on: May 18, 2016, 08:13:00 pm »
That board is configured to switch the relay active low, so when the IN is pulled to ground. You *should* be able to connect the relay boards VCC to the Oak's Vin, and then the Oak will trigger the appropriate relay IN pin is pulled LOW ( ie, to GND). To control just one relay (i.e. relay 1), you would have VCC on the relay board connected to Vin on the Oak, GND of the Oak connected to the relay boards GND, and IN1 connected to a pin of your choice on the Oak. You should be able to toggle that pin high and low, and the relay should click when the pin is low. You can test this behaviour by connecting IN1 to GND, and the relay should click.

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: Question about VIN
« Reply #7 on: May 18, 2016, 11:26:50 pm »
Well there you go... I should have looked at the schematic. Pete is correct, the IN's are active low. Looks like a fairly robust Relay board for the price. May have to get one.

atkulp

  • Newbie
  • *
  • Posts: 22
Re: Question about VIN
« Reply #8 on: May 19, 2016, 03:00:54 pm »
Thanks to everyone!  VIN works great.  The only problem was I didn't solder my connections!  I was trying to fake it with tension and a breadboard, but I broke down and soldered headers to the Oak.  The weak connection must have introduced enough resistance that it didn't work right.  Since it was clearly engaging, I wouldn't have expected that!  It's working just great now.  I've got a garage door hooked up to one and will connect the other one soon.  I really only need two relays so I'll probably order the twin unit.  I'm quite happy with it and will continue to extend it with door sensors as well.

Just to let everyone know, there's a Windows universal (Store) app called Rester that lets you do REST requests on desktop or Windows Phone.  I'm using this to send the Particle.io commands and it's just about instant.