Warning

 

Close
Confirm Action

Are you sure you wish to do this?

Cancel Confirm
AR15.COM
6/19/2016 1:54:39 PM EDT
There's 4 conductors, +5v, gnd, and 2 more.  





What do those do and how do they do it?







I built a desk trinket/talking piece and it is powered from the 5v off a usb port.  If I could, Id like to give it some timed functions programmed from my laptop.  I want it to operate like a pump jack on a timer (damn stripper wells)



Currently it just has a switch to turn it on and off.







Is this possible?







Also, does anyone sell a high quality usb cable?  


 




6/19/2016 1:57:36 PM EDT
[#1]
Last question first. For good USB cables I always go to monoprice.

Two wires are power. 5v and ground.

Other two are data.

What is this thing and what do you want it to do?
6/19/2016 1:59:01 PM EDT
[#2]
Is that a perpetual motion machine
6/19/2016 1:59:15 PM EDT
[#3]
That's a model pump jack I built.

I want it to come on and run for ~30s, at a random interval like every 5-30min.

Posted Via AR15.Com Mobile
6/19/2016 1:59:21 PM EDT
[#4]
Arduino
6/19/2016 2:00:25 PM EDT
[#5]
Quote History
Quoted:
Arduino
View Quote

Ya, if i wanted a free standing setup, but i was thinking i could use my laptop.  I only want it to run when I'm at my desk.

Posted Via AR15.Com Mobile
6/19/2016 2:01:40 PM EDT
[#6]
probably easier to use an AC timer like for lamps and such and then power it using a usb charger for like a phone.
6/19/2016 2:04:53 PM EDT
[#7]
Quote History
Quoted:
probably easier to use an AC timer like for lamps and such and then power it using a usb charger for like a phone.
View Quote

That would certainly be easier.

Posted Via AR15.Com Mobile
6/19/2016 2:08:52 PM EDT
[#8]
Haven't coded in a while but I think you can write a small program in c that generates a random timer that would turn it on/off pretty easily.
6/19/2016 2:09:19 PM EDT
[#10]
Easiest way is to do something with an Arduino. Controlling it directly via a laptop USB port would require some hardware/firmware on the device and intimate knowledge of the USB protocol and driver programming.
6/19/2016 2:11:23 PM EDT
[#11]
Quote History

That's pretty neat.

Posted Via AR15.Com Mobile
6/19/2016 2:11:38 PM EDT
[#12]
As noted, the center two pins are a differential pair for data. The USB communication protocol is astonishingly complex, and there's no 'direct' way to do what I think you want to do. You couldn't, for example, force one of those pins high to control a relay.

The simple solution here is the one you're already using; a mechnaical switch. The more complex solution is to use a USB to TTL converter and a relay to turn it on and off. You could do the same thing with an arduino, which is a little more complex but also more newbie friendly and flexible.
6/19/2016 2:12:33 PM EDT
[#13]
Quote History
Quoted:
Easiest way is to do something with an Arduino. Controlling it directly via a laptop USB port would require some hardware/firmware on the device and intimate knowledge of the USB protocol and driver programming.
View Quote

so i can't just somehow toggle a signal?

Nope.  Answered above.

Posted Via AR15.Com Mobile
6/19/2016 2:13:12 PM EDT
[#14]
Quote History
Quoted:
As noted, the center two pins are a differential pair for data. The USB communication protocol is astonishingly complex, and there's no 'direct' way to do what I think you want to do. You couldn't, for example, force one of those pins high to control a relay.

The simple solution here is the one you're already using; a mechnaical switch. The more complex solution is to use a USB to TTL converter and a relay to turn it on and off. You could do the same thing with an arduino, which is a little more complex but also more newbie friendly and flexible.
View Quote

Damn.  Thanks for the info!

Posted Via AR15.Com Mobile
6/19/2016 2:18:08 PM EDT
[#15]
Here's a link that might pique your interest.

Electromagical stuff
6/19/2016 2:20:40 PM EDT
[#16]
Quote History
Quoted:

That's pretty neat.

Posted Via AR15.Com Mobile
View Quote View All Quotes
View All Quotes
Quote History



It's really all you need for your project.  Yes, an Arduino would be cool, but that little USB relay should do the trick and comes with a C++ library.

I haven't programmed in years, but I think you can download Visual C++ or something similar, and build yourself a progam and UI to control your pump.

If you're going to do more of these projects though, I'd buy an Arduino dev kit, they've got to be pretty user friendly and there's a ton of stuff you can do with them.  As other posters mentioned, you could build a stand alone controller using the I/O on the Arduino.
6/19/2016 2:22:55 PM EDT
[#17]
Quote History
Quoted:
Arduino
View Quote

This

It wouldn't take much effort to code up one to simulate the motion.

Do you need to vary the speed our just turn it off and on at various times? A simple...

Loop() {

delay(value);

}

6/19/2016 2:25:03 PM EDT
[#18]
I only want it to run when I'm at my desk.
View Quote

Pressure switch under your seat cushion.
6/19/2016 2:39:53 PM EDT
[#19]
You could toggle the power on & off to that particular USB port.
6/19/2016 3:10:30 PM EDT
[#20]
Quote History
Quoted:



It's really all you need for your project.  Yes, an Arduino would be cool, but that little USB relay should do the trick and comes with a C++ library.

I haven't programmed in years, but I think you can download Visual C++ or something similar, and build yourself a progam and UI to control your pump.

If you're going to do more of these projects though, I'd buy an Arduino dev kit, they've got to be pretty user friendly and there's a ton of stuff you can do with them.  As other posters mentioned, you could build a stand alone controller using the I/O on the Arduino.
View Quote View All Quotes
View All Quotes
Quote History
Quoted:



It's really all you need for your project.  Yes, an Arduino would be cool, but that little USB relay should do the trick and comes with a C++ library.

I haven't programmed in years, but I think you can download Visual C++ or something similar, and build yourself a progam and UI to control your pump.

If you're going to do more of these projects though, I'd buy an Arduino dev kit, they've got to be pretty user friendly and there's a ton of stuff you can do with them.  As other posters mentioned, you could build a stand alone controller using the I/O on the Arduino.

I'll look into them.  My next office toy is going to be a drilling rig to accompany the pump and it may end up with my animation.  Arduino sounds perfect for that.

Posted Via AR15.Com Mobile
Close Join Our Mail List to Stay Up To Date! Win a FREE Membership!

Sign up for the ARFCOM weekly newsletter and be entered to win a free ARFCOM membership. One new winner* is announced every week!

You will receive an email every Friday morning featuring the latest chatter from the hottest topics, breaking news surrounding legislation, as well as exclusive deals only available to ARFCOM email subscribers.


By signing up you agree to our User Agreement. *Must have a registered ARFCOM account to win.