Momentary Switch Question

First off I am a noob, no experience yet with Spark Core and arduino. I understand how the code works a lot better than how the hardware works. I ordered the Spark core to use in a project where I am simply going to wire it with a momentary switch to turn on a toy. Eventually i want to turn the toy on via wifi.

Essentially I need to complete a circuit for a few milliseconds then disconnect. If someone with more experience could give me an example or push me in the right direction I’d greatly appreciate it!

Are you thinking of controlling a switch on the toy or the power supply to the toy?

  1. Power supply you would need to use a relay

  2. A switch would require you to solder some wires on the toy but a relay is not required. Maybe just a small electronic switch(transistor) is required

Both ways, you need to somehow modify the toy a little :smiley:

The toy uses a momentary switch to initiate lights and sound on the toy. I want the switch to remain so the toy can still be used manually. When I briefly bridge the two solder points behind the switch the toy activates, however, if i maintain contact between the two points the toy does nothing.

I hope that helps.

Any picture?

The toy is looking for a pulse we call it.

High to low or low to high.

If we can find out which side of the 2 solder point is the input, we can tap a wire to that point and send a High/Low pulse.

Not too difficult but you gotta get ready for some hands on!

TheRick, not knowing what voltage is on those pins, it may be best to use a small relay in parallel with the switch. However, following kennethlimcp’s line of thinking, it would help if you measured the voltage on either side of the switch but you will need to do so relative to the toy’s ground, AKA the negative side of the battery or battery pack. Come to think of it, how is the toy powered?

1 Like

Sounds like the momentary switch puts signal to ground (Not necessarily High to Low).

He could test it with a NPN transistor, 1K Ohm Resistor to base of 3904; 1 solder point of switch to transistor collector and Emitter to Ground. I use 4N25 Opto Transistors for this as well.

Test it with 3.3 or 5 volts to 1K resistor momentarily to see if toy comes on. If not, switch to other solder point of switch and test.

What do you think Kenneth ?

Actually for a beginner, the multimeter would be best to check stuff out :slight_smile:

Find the ground, tap both sides of the solder joint.

Then press and see what’s the change to the voltage.

If it’s a 5v/0v change, I will connect a diode from the digitalpin to the input pin on the button.

Always a turn off when relays have to come in for something so simple but well, that’s electronics!

Im thinking the circuity should be quite simple for the switch! :wink:

Agreed on the relay kennethlimcp but I am concerned about isolation. Spydrop, he emitter follower is a great idea but we need to know what that thing is doing before recommending anything. My bet is on that switch going to ground! :slight_smile:

True that on isolation… so I thought of the diode :smiley:

I don’t think the toy is gonna kill the core with a diode…if it does…is that even a toy?! :smiley:

1 Like

Killing toys is not what I want to do :smile:

A transistor or 4N25 Optotransistor is a whole lot smaller than a relay but, very true that it must be determined what the switch is doing in way of either simply going to ground or is it applying voltage to activate toy.

There are only about a million different ways to do this depending on the voltage and current requirements, high-side, low-side switching etc:

  • Direct connection from Spark core pin
  • Diode protected connection from Spark core pin
  • A relay
  • A solid-state relay
  • An optoisolator (always good!)
  • A CD4066 transmission gate
  • A FET
  • A BJT transistor

and on and on and on.

It would just be a lot easier to help if we knew more about what you are trying to control.

1 Like

Does the toy plug in to the wall or is it battery powered? If it’s battery powered, there’s less of a chance of killing the Core (unless it’s 9v batteries). A lot of my daughters’ toys that are battery powered are between 3v and 6v, which wouldn’t kill a Core (it depends on how the batteries are wired). However, the only control I ever want to have of those toys is taking the battery out when they play it to death. :wink:

I recommend a solid state relay.

To the core it will look like a led.

To the toy it will look like a switch.

There need not be any electrical connection between the two.

A part like this will work, but there are a myriad other equally good choices.

I’m at work atm so i’m limited as to the detail i can provide you. I/ll post more once i’m back with the toy. It runs on 4x AA batteries.

Here is the toy: http://us.thegoallight.com/store/#!/~/product/category=1620116&id=15439010

I plan to post it in project share when i have it working. I’m looking to get it to be triggered when your favorite team scores a goal. Should be a fun project.

We are so gonna hack up the remote control!!

1 Like

I thought about that, but the spark won’t fit inside the current remote housing. The light itself has some spare room.

Between ground and one of the points on the switch I have 5v. It fluctuates about .2v-.4v when the button is pressed, but stays right around 5v.

TheRick, since you have a multimeter, can you see if either side of the switch is connected directly to the battery + side. Remove the batteries first just be be sure. This is to make sure the 5V is either straight from the battery or from the internal logic. :smile:

AH NICE :smiley:

should look something like that:

Your multimeter is tapping on ground and the other pin is the horizontal line

I think @AndyW gave a good idea on using a Solid State Relay, so we need:

The dashed lines is the :spark: core side and solid line is the toy side

The 1k resistor is arbitrary but i think should be enough to trigger the SSR. The input will be a Digital pin. I can tell you the resistance value to use if we choose the SSR for the project :smile:

Looks like we are good to go and you can have it running like this weekend?!

The 5v is coming right from the battery.