Jump to content

I Created A Sainsmart (Cheap Relay Board) Driver


Recommended Posts

  • Content Provider

@DJRobX:

I have just integrated your code into DOF. Compiles without problems. I'm trying to finish some other work which is in progress, so I can build a test version which I can share with you.

Obviously, I will not be able to test the sainsmart integration, since I dont have the hardware. So this will be up to you.

Will also drop you a PM

Link to comment
Share on other sites

  • 2 weeks later...

I don't have a ledwiz, but by DOF's design, they should work together.     DOF supports multiple LEDWiz's.   So, if you map the Sainsmart to emulate Ledwiz #2, you can in turn map that to a different ledwiz.ini file in the cabinet config file. 

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

I'm trying to test out the Sainsmart as a second output device using DJRobX's plugin code and I'm stumped as how to get it up and running.  I tried to set up a GlobalConfig_B2SServer.xml and Cabinet.xml file but can't get DOF to activate the Sainsmart.  Not sure if I'm putting the right info in these files though because with my initial ledWIZ setup (which works just fine) I didn't have to create these files as DOF finds what it needs automatically.

 

Does anyone have any tips?

Link to comment
Share on other sites

I had a lot of trouble getting the configs right initially as well. Make sure to explicitly specify the full path to the referenced files (ini, XML) and use the config test tool to see if it's picking everything up. If you pick a table with toys you'll be able to activate them from the first screen. If the toys are missing, one of the configs isn't getting picked up.   You can see on the other tabs what it thinks is configured and what ports are active.  

 

I suggest starting with the most basic config (copy the ones I included, edit the paths to match yours, and just try to get the SainSmart working by itself) and then work backwards to include your Ledwiz. 

 

The next version of DOF will officially include this support.  The config files will look a little different, but the same general principles will apply. 

Link to comment
Share on other sites

  • 2 months later...

I'm a little confused as to what I'm looking at.    Are the black lines an existing working config?   Where was the "to ground" and the other wire in the upper right of that picture going before?

 

You only show one wire going to power up the sainsmart (atached to "to ground").   The sainsmart will need either 5v or 12v of power depending on which model you purchased.    These could be the same as the + and - feeding the device, but it's probably preferable to use a different power supply).   Some people have "hacked" the 5v versions to power up off the USB connector.     I power my 12v sainsmart board from the PC's power supply.

Link to comment
Share on other sites

Sorry, that was a quickie on a pic in this thread (the red is stuff I added...)

 

http://www.hyperspin-fe.com/forum/showthread.php?7572-Cheap-and-Easy

 

My Sainsmart is connected by usb so I didn't think it needed additional power. I was splitting power off a 12v laptop power supply. My understanding was each channel of the relay was like on/off switch

 

The ground was going to an ipac in original pic.

 

Not sure why wires are connected to large studs...

Link to comment
Share on other sites

Thanks, that helps a lot.    H4CK3R's diagram makes the solenoid fire whenever the leaf switch is pressed.   That part is really just a big relay, so when the solenoid fires, it connects the left and right (large) posts.  He uses the relay output to give the iPac the input (so it also knows that the button was pressed).

 

If you're trying to hook up the solenoid to the Sainsmart just for a PC-controlled effect, you don't need to hook anything at all up to the two outermost posts.    In other words, the Sainsmart's relay (B and C on your diagram)  takes the place of the two connections on the leaf switch, not the ipac.   The iPac is what should have the X through it.

Link to comment
Share on other sites

You only need two wires to fire a solenoid.    The "-" is the ground.   That's why it attaches to the bracket - in automotive applications, you can rely on the car's body being the ground (which ultimately connects to the - terminal on the battery).

 

In the case of H4C3R's iPac connection, two power supplies are involved - one for the iPac and one for the solenoid.   In that diagram, "Ground" is the iPac's ground.   "-" is the solenoid's ground. 

 

In your case you will also probably have two power supplies involved, but the +/- for the Sainsmart will be always on, and connect straight to the board from the power supply.  They should not go through the solenoid as you don't want the board disconnecting when it fires.  :)

 

Also, be careful with the diode.  If you put it on backwards, you'll short out the power supply.

Link to comment
Share on other sites

Getting clearer ;)

There is a ground on Sainsmart. I took that to be the third wire in a 3 wire electric situation (+,- and ground) vs lamp style 2 wire. Plus the importance of connecting all the grounds for the buttons.

As usual with vp, I'm swimming just outside of my depth!

Link to comment
Share on other sites

The sainsmart has a GND and VCC connection because you need to supply it with 12v or 5v, depending on the model you bought.  These are to power up the device, it does not self-power by USB unless you modify the the 5v version to do so.   

 

The grounds all need to be connected on buttons because they complete the circuit when you push the button in.   

 

You should not tie the "grounds" from different transformers together.  

 

The "ground" wire in a 3 wire power cord is for safety.   If the neutral and hots get shorted, the third wire ensures that there is an alternate path to ground and ensures that the circuit breaker will trip.    See here:  http://electronics.howstuffworks.com/everyday-tech/question110.htm

Link to comment
Share on other sites

This isn't meant as offense to you, dboyrecords. But I find that so many people look for an exact "how-to" do precisely the thing they need to accomplish, almost going out of their way to not just learn the core basics of what is involved. That's somewhat understandable if you're say, setting up unfamiliar software. But this shit... electricity and circuits and what-not, is kind of serious.

 

It's worth taking some time to learn and understand concepts of E&M before attempting to build a circuit. If not to better yourself with powerful (heh) knowledge, then to prevent you from accidentally burning your house down or something.

Link to comment
Share on other sites

In his defense, I can certainly understand why he'd get confused.    "Ground", "common",  and "-" are usually referring to the same thing in a low voltage application, but you really need to consider the context.     When drawing schematics they have specific symbols for different meanings that are a lot clearer.   Check out this link:

 

http://www.epanorama.net/newepa/2009/10/08/use-right-ground-symbol/

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...