Connecting a 24v appliance to Raspberry Pi. - Raspberry Pi General

Hello, I am trying to do an Internet of Things project with the help of a Raspberry Pi. While most of the project is complete, there is one small thing I am stuck at. I need to connect a solenoid valve to the Pi. The valve needs a voltage of 24v-36v to operate. I connected three 9v batteries together in series to operate it. The valve opens when the voltage is applied and closes when it not. I want to control the opening and closing of the valve by the Pi’s GPIO pins. I’m using a NPN 2N3904 transistor for that. However, it’s not working. The circuit works sometimes and doesn’t work other times when I manually pull and put in the GPIO pin. It never works with code. Is the 27v causing problems with the Pi? What can I do? Is there another way to control it apart from NPN transistors?

i suggest to use a 5v relay with an external power supply to control your solenoid.
Regards.

Related

USB Host

anyone has tried yet usb host functionality ? I found the drivers of ETEN M600/G500 but not tried yet... processor should be the same so the trinity should support this function.
Thank you for your enquiry, the p3600 was not designed to allow usb memory expansion as such there is no current or planned method to enable what you have requested.
It may be possible to find a 3rd party solution but this would not be supported by ourselves but the solution supplier.
Should you have any other problem, please do not hesitate to call us. Your Local number can be found at http://www.europe.htc.com/support/cs_by_phone.html
Best regards,
HTC Support
Guybrush said:
I found the drivers of ETEN M600/G500 but not tried yet...
Click to expand...
Click to collapse
Could you share either a link or the file?
Should be this
OK, I'm with Hermes, but anyway... According to the specs, E-Tens have S3C2440 while we have SC32442, but they should be the same. The schematics of the evaluation board (p.6) shows that there are two USB hosts: one from DN0/DP0 pins, the second from DN1/DP1 pins. The latter can also be configured as USB Device... and that's what we have at our MiniUSB connector.
So... if E-Ten uses the first USB Host pins, we're out of luck. If they've implemented it in shared mode, the driver should work. But I have a reason for a doubt: M600/M500 have separate I/O pins for USB host and device, while the connector itself is provided on the cradle. If they made it shared, it would be more easy to implement host/device sharing in the cradle rather than in the device...
A soldering iron may help, but I don't want to loose the warranty yet.
An owner of the Platform Builder may recompile the driver to utilize the shared pins as well. That's a better solution.
If you want to make an adapter for tests, note, that you need to supply +5V from an external power supply (which can be a PC USB port), and that you don't need to cross the pins: DN1 is D- for both host and device, and DP1 is D+ for both. Nothing but connectors and wires should be required.
One more note: a USB Host driver for a shared connector should shut down USB Device driver, something similar that WM5torage does. This also makes me doubt that E-Ten uses shared pins, and that's why I believe that a different driver is required.
But it should be possible!
OK, I've made an adaptor from MiniUSB male (to TyTN), USB A female (for devices), and MiniUSB female for power supply.
In the MiniUSB male I shorted pins 4 and 5. At least this way I can use it for charging from other power supplies, and I think it hould not harm, because pin 4 on GND means USB Host for MiniUSB.
I've installed the above drivers, and also USB Mass Storage drivers (attached).
I have a USB mouse, a card rider (4 slots), an MP3 player, and an RS232 port.
Nothing but MP3 player showed any sign of an activity in all my tests.
The MP3 player shows "MASS CONNECT" on its screen if it detects USB activity. If it does not, it just turns to normal operations, showing that it takes power from USB. It turned to this mode after I installed the attached driver. But I see no a mounted disk on TyTN itself.
So, it works somehow, and I'm almost confident it can be made to work...
Probably I just did something wrong... Who else wants to try?
I must add that installed stuff didn't affect the USB Device from working: ActiveSync connects OK, and WM5torage 1.73 works as before.
Hardwarewise, there are a couple of things to try: disconnect pin 4 from GND at the phone side, disconnect power supply from the phone (providing it only to the attached device), or both...
i'm waiting connectors to try something by myself too. Thanks Lurker0 for all this tips.
thread about usb host from eten users
http://www.eten-users.net/index.php?showtopic=4328&st=0
I ended up with a hard reset Of course I made full backup before the tests.
I've found out that GPRS stopped working. The error messages were like "Modem not found" and "The current call should be finished before data connection" (from memory and ranslated from Russian).
Then I found out that hardware settings for OHCI are wrong:
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\OHCI]
"MemBase"=dword:B0900000
"Irq"=dword:0000000B
"UseExistingSettings"=dword:00000000
"MemLen"=dword:00001000
"SysIntr"=dword:00000011
"Order"=dword:00000001
"Index"=dword:00000001
"Dll"="ohci.dll"
"Prefix"="HCD"
"InterfaceType"=dword:00000000
IRQ should be 0x1A (from working registry and also Samsung datasheet), and memory base 0xB5900000.
I've deleted ohci.dll and usbd.dll, then uninstalled that HID driver to no available. I needed a working phone now, and decided to hard reset and restore.
It's strange why IRQ and MemBase were wrong. It may explain why it didn't work. Good I noticed them before tests.
Hey Lurker0
Did you get around to trying it again or was the project abandoned?
Would love to hear how you are going with this if you're still working on it =)
No, I did nothing since that.
HTC Herald compatibility
Does anyone know if the herald can host any USB devices

diy mircousb hub

hi folks,
i would to like to build a micro usb hub.
e.g. 1 male connector and 2 female connector.
does anybody have experience in micro usb to stabilize the voltage and current?
thanx
KindsKoPP said:
hi folks,
i would to like to build a micro usb hub.
e.g. 1 male connector and 2 female connector.
does anybody have experience in micro usb to stabilize the voltage and current?
thanx
Click to expand...
Click to collapse
That would be interesting to see, I think your gonna need drivers for that as well because your gonna need a switch to cycle back and forth on what connector your using, and thats gonna be hard to do from scratch. I was contemplating doing something similar to that but wound up at a dead end. If you figure it out let me know.
it won´t need a driver. i want to build as a host hub. but the current is too low i think, so it is difficult to stabilizise the current,,
mbm262 said:
That would be interesting to see, I think your gonna need drivers for that as well because your gonna need a switch to cycle back and forth on what connector your using, and thats gonna be hard to do from scratch. I was contemplating doing something similar to that but wound up at a dead end. If you figure it out let me know.
Click to expand...
Click to collapse
It's not a question of stabilizing the current.
It's supposed to be 5 volts throughout the USB spec.
If you are using a cell phone as the host, that already produces regulated 5 volts through a charge pump.
The amount of current out of a cell phone is maybe around 100 mA.
That's what you have to work with.
If it's not sufficient for what you want then you need an external power source, not a regulator.
Hubs can be power hogs.
The spec says that a hub can take up to 100 mA all by itself.
To make a micro USB you can either take an existing hub and change the connectors.
Of course since the PCB pattern will not match up you'd have to wire the connectors in discreetly.
If you really wanted to make a real job out of this, buy a hub IC for $3,
lay out a PCB, slap on a 24 MHz crystal and connectors.
???
the idea is to build an mobile hub for tablets or smartphones for plugin external devices like sd card reader or usb stick and
mouse and keybord. hub will stick in a phone and plug in the external devices. i already had tried with a keyboard and mouse with standard usb and it works. i had already build some devices with micro usb connector. so i would like to use all devices at the same time and outdoor. i try to solve the idea without a lot of adapter..
if the usb give all devices 5v and 100mA at the same time, that would be great, without an additional IC power supplier..
thats all
i found out thats not possible to use more than 2 gadgets at the same time cause of the voltage without an external power supplier. keyboard and mice work at the same time but i f u want to plug in a 3rd gadget then wont work. 1 solution could be a mobile battery with 5v connecting with the hub. or make a built in battery in the hub..
@ renate. maybe u have an suggestion?
I have a jig for measuring current consumed by USB peripherals: http://forum.xda-developers.com/showpost.php?p=30668417&postcount=26
I use USB with only low power things like a keyboard or else
with a powered hub (also back-powering the Android).
The second option is more like a docking station.
KindsKoPP said:
hi folks,
i would to like to build a micro usb hub.
e.g. 1 male connector and 2 female connector.
does anybody have experience in micro usb to stabilize the voltage and current?
thanx
Click to expand...
Click to collapse
The 2 female connectors don't make much sense i think, because:
I can't think of any device you would like to connect with your phone as host that has a µusb connector..? You would need 2 additional OTG-cables in almost all cases
You would need OTG capability for security reasons: Imagine you hub is pluggend in you phone and you connect you computer to the hub too -> Data crash + 2 power sources in parallel -> risk of damage
I would use a normal tiny usb hub and only change the cable
u did not read my post above attentively or?
quote:
i had already build some devices with micro usb connector. so i would like to use all devices at the same time and outdoor. i try to solve the idea without a lot of adapter..
and the gadget are already automatically OTG. I already thought all about that before!
-schumi- said:
The 2 female connectors don't make much sense i think, because:
I can't think of any device you would like to connect with your phone as host that has a µusb connector..? You would need 2 additional OTG-cables in almost all cases
You would need OTG capability for security reasons: Imagine you hub is pluggend in you phone and you connect you computer to the hub too -> Data crash + 2 power sources in parallel -> risk of damage
I would use a normal tiny usb hub and only change the cable
Click to expand...
Click to collapse

My first project - Project GAMETRIX

Lapdock+Wii == Gametrix
So I have a spare Nintendo Wii and a lapdock (hopefully pick some more up if there are still any at Radioshack) and I am going to disassemble the Wii, reconfigure it to fit on the back "panel" of the Lapdock, and get the needed cords to create a Gametrix
My initial goal is to connect a Nintendo Wii to my Atrix Lapdock by... (with modifications)
1) a. Having the Lapdock’s Male Mini-HDMI plugged into a Female Mini-HDMI TO M / F Fullsized-HDMI converter. Thus allowing a direct HDMI connection from there.
This takes care of ½ of connections for both the Lapdock and the Wii.
2) a. Ideally I am looking to hook the Wii’s power supply directly to the Lapdock’s Male Micro-USB port, via a Female Micro-USB TO M / F Fullsized-USB. From there I’d need a USB to Female Wall Outlet (3 prong?) this would entail finding(unlikely...) / building one.
This takes care of power needs, (if it works) leaving only the unlikely usability of the Lapdocks built in keyboard and mouse / USB ports.
2) b. if number 2 section a (above) doesn’t work because of lack of volts traveling through the USB to the Wii, then I’d be left with connecting an external battery to the Wii and just taking advantage of the screen.
Hopefully if I have to result to section b then I’d at least be able to use the keyboard and mouse?
I will update with a Diagram of my plan “a” and “b” tomorrow after school.
This is my first Project, I'm still learning, and still planning so don't expect anything yet. I' moved this thread from Atrix thread, as it fits better here
I guess there should be no problem with using it as a monitor and keyboard/mouse, someone already done that, google: "Using a Motorola Atrix Lapdock as a HDMI Monitor and USB Keyboard / Mouse" (can't post URLs :/ ).
2a) USB won't be able to supply enough power. And you want to convert 5V DC to 110V AC?! Forget about it.
2b) Maybe you will be able to use Lapdocks internal battery (with some hardware modifications). I think it can store about 40Wh, so that should allow to run Lapdock and Wii for about an hour.
The wii's power cable is a 3 prong 12v wall outlet cable. The Lapdock is capable of outputting a total if 12v or so I've read, and the Wii requires 12 volts to boot, and it runs on 10v. Im not sure how many volts the Lapdock display will draw though so I'm still very hesitant on how I'm going to solve the power issue. I want to run everything off of the lapdocks battery. Is this possible? Any recommendations are appreciated. Thanks!
"Female Wall Outlet" - I somehow convinced myself that you mean Wall Plug, sorry about that Google says that power supply for Wii is rated for "DC 12V 3.7A". Even if there is a 12V rail on Lapdocks PCB it probably won't be able to handle additional 3A. You can try to build your own power supply circuit and connect it directly to Lapdocks battery, bypassing its internal circuits. Battery in Lapdock is rated for 11.1V. Do you have any experience with electronics (soldering, circuit design etc)?
No, this is my first project, I decided Im not going to get my feet wet with electronic modifications, instead I'm just going to dive right in If you have any info for me about dealing with circuits, inverters, and batteries that you could share, that'd be great as we'll. I can find any documentation for powering the Wii because I'm certain you can't just throw 12v at it, it has to be split right? Like a lot of consoles need 9v and 45v... it's a lot to learn so any help is greatly appreciated.
If you are going to use 2 pin power connector on the back panel of the Wii it's enough to supply it with 12V (one of the pins is +12V, other one is ground), but the hard part is that Wii can consume up to 4 Amps. Because you're not experienced in electronics I think you can consider:
1) getting a battery pack like this one, (unfortunately it can supply only 2A, getting 4A one may be difficult/expensive).
2) using 4 cell battery pack (for example: a laptop battery), which should give you something between 13V and 15V, and LDO (low dropout voltage regulator), like LM1084, to get 12V output.
[edit[
There are many other possibilities, it all depends on how much time/money you want to put into this project.
Let us know how it goes. I'd be interested in seeing the progress of this project.
I've had to put all electronics on hold for a bit, school and community service is pretty overwhelming ATM, but I guarantee that I'll follow through with this and finish it. Thanks for all the suggestions guys!

[Q] How to hack a single micro usb for charging and data transfer at same time

Hello guys, I'm trying to interface android tab with peripherals. Problem is, it is having only one micro USB port which is used for charging and otg/host, only one function is possible at a time .But I need to charge the tab and simultaneously transfer data to peripherals, say for example I need to use external mouse and charge the tab at same time.
So, is there any way to do it?
I know usb has 4 pins 5v,d+,d-,gnd. I thought to wire charging input power to tab pin 5v and gnd and pin D+,D-of tab to mouse D+, D- and giving external power supply to 5v and gnd pin of mouse.
Is this a right method? To charge and transfer the data at the same time?
Kindly help me. Suggest a better way to do it.
(mini & micro) USB connectors have 5 pins: Vbus, D-, D+, Id, Gnd.
For OTG, the Id pin is connected to Gnd.
It's like the old adage, "You can lead a horse to water, but you can't make him drink."
You can connect a peripheral to an OTG host and have it work fine.
You can then connect an external power supply across the Vbus and Gnd.
The problem is, how does your host device know that it can "drink"?
There are basically two ways.
If the host detects power on its input before it switches into OTG host mode it may continue to charge.
If the host is in OTG host mode, device-specific commands to the charging circuits may convince it to charge.
There may also be non-standard Id resistor values for signalling host & charge for some devices.
I think your mileage would vary very much depending on what devices your using. AOS was not meant to deal with people hacking on the USB port, and probably the code to implement those features depend on your HW/FW.
If its a Samsung, you can play with some resistor values like these:
http://forum.xda-developers.com/showpost.php?p=25532839&postcount=2
I think the USB "CarKit" specifications should allow you both to charge and "connect" in some way.
A more easy solution would be to use a BlueTooth mouse and keep charging as usual.

protecting a Raspberry Pi GPIO pin from being fried

What is the recommended way of protecting a Raspberry Pi GPIO pin from being fried as a result of unintentionally setting the pin to output mode while it is indirectly connected to the opposite polarity (ground or 3.3V) through a sensor (because it is intended to be used as an input pin connected to the sensor instead of an output pin)? I've read that there are different protection circuits for the GPIO pins that can be implemented, but I don't know which one that is sufficient for this particular situation.

Categories

Resources