Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
CarForumPoster
Jun 26, 2013

⚡POWER⚡

Empress Brosephine posted:

Hmmm not sure exactly where to ask this, as perhaps my arduino can do this for me but i'm trying to make something that utilizes a Fan like this:

https://www.amazon.com/gp/product/B00WM7TRTY/ref=ask_ql_qh_dp_hza


that can be turned on or off with a keystroke.


I figured the way to do it would be to somehow manage the power provided to it but I don't even know if something like this is possible. Help me goons!!!!

You'll need to check the ratings but this is probably what you want:
http://www.sainsmart.com/sainsmart-4-channel-5v-usb-relay-board-module-controller-for-automation-robotics.html

I use a python script I found online to turn things on and off with it. I use it to run a motor for 3 seconds by having a script thats basically:
python run.py -ON
Wait 3 seconds
python run.py -OFF

You can bind this to a key very easily in windows by making it a .bat file and setting a key to run it.

EDIT: I didnt notice that it is a USB powered fan and assumed it was a normal 110V fan. You can turn off USB port power in windows supposedly but I don't know how to do so in a way that you can bind to a key. With the thing I linked above you can regulate basically any power source. For electric motors specifically, derate the current to about 10% of what it says it can do. So if you want to use a 10Aamp/120V relay on a motor, don't use more than a 120V/1Amp electric motor

CarForumPoster fucked around with this message at 00:37 on Nov 29, 2016

Adbot
ADBOT LOVES YOU

Empress Brosephine
Mar 31, 2012

by Jeffrey of YOSPOS
Yeah a 110v fan would work too thank you so much for the help!!!!!!!!!!!!!!

CarForumPoster
Jun 26, 2013

⚡POWER⚡

Empress Brosephine posted:

Yeah a 110v fan would work too thank you so much for the help!!!!!!!!!!!!!!

No problem. If your weary of the safety of Chinese electronics, as I am, you may realize as I did that if I wire two relays on that board in series and turn both on and both off it makes the probability that both will fail in the closed position approach 0. For the thing attached to my motor this is very important. For a fan it's probably not as a fan setting itself on fire by running would be lifes great irony.

Empress Brosephine
Mar 31, 2012

by Jeffrey of YOSPOS
Yeah, I'll probably go down this route, but there might be better ways of doing it;

basically what i'm trying to do is play a video and have a fan blow air to simulate a sensation of speed when the play button is held.

I wonder if there's any USB fans that can be turned on / off via software?

CarForumPoster
Jun 26, 2013

⚡POWER⚡

Empress Brosephine posted:

Yeah, I'll probably go down this route, but there might be better ways of doing it;

basically what i'm trying to do is play a video and have a fan blow air to simulate a sensation of speed when the play button is held.

I wonder if there's any USB fans that can be turned on / off via software?

Every computer fan works this way.

https://lifehacker.com/5866009/control-your-computers-fan-speeds-for-better-performance-when-you-need-it-silence-when-you-dont

Might be able to piggy back one of the PWM signals....still I think the USBrelay is the easiest "all the engineering done for you" and most reliable route if you only need on/off. If you want to control fan speed...thats a different story.

CarForumPoster fucked around with this message at 02:30 on Nov 29, 2016

Empress Brosephine
Mar 31, 2012

by Jeffrey of YOSPOS
yeah just a simple on/ off i'll prob do the usbrelay then. thanks again for the help

CarForumPoster
Jun 26, 2013

⚡POWER⚡
Last tip, if you need to not have the clicking sound of the relay, USB controlled solid state relays exist.

Never used this one but an example: http://numato.com/2-channel-usb-solidstate-relay-module/


These also (usually) have fewer issues with controlling motors if you need a large fan because they're often optoisolated and they can be turned on and off faster (>1Hz)

CarForumPoster fucked around with this message at 02:34 on Nov 29, 2016

Empress Brosephine
Mar 31, 2012

by Jeffrey of YOSPOS
Seems pretty straight forward though which is nice. Thanks for the help.

CarForumPoster
Jun 26, 2013

⚡POWER⚡
I finally have a reason to buy an Arduino! I need to build an automated test stand for a relay control board for a project and bought this thing: Smraza Mega 2560 Basic Starter Kit. I need it to act as a data logger for time and voltage (5V signal) and figured I could use the ADC pins for that.

The setup is basically:
Connect arduino to laptop
Connect relay control board to laptop.
Run bash script that runsa bunch of python scripts to actuate relay control board and try to break the controller software.
Get feedback from arduino that the output of the controller was within range of actuation times and voltages.
Spit out a log on the laptop saying pass/fail.

Any horrible flaw in this plan?

Sagebrush
Feb 26, 2012

Sounds reasonable as long as you have some way of accurately timestamping the output and input, and the timescales you're concerned about aren't so short that you run into issues with serial communication lag or just running faster than the Arduino can keep up with. Since you're talking about relays I assume the measurements are on the order of tens to hundreds of milliseconds, which shouldn't present any problem if you use interrupt code.

How do you talk to the relay control board? Ideally, you'd do all of the I/O in a single program so that you don't have to worry about synchronization. You write a Python script or whatever that triggers the relay through whatever protocol it uses, starts a timer, watches the serial port for the Arduino's response, stops the timer and stores the value.

e: voltage monitoring may be challenging as there is some lag in reading the ADC (microseconds, but it's enough that you can miss small transients). Depending, again, on the scale of what you're measuring, you might not be able to get useful data there. An Arduino isn't a good replacement for a storage oscilloscope.

Sagebrush fucked around with this message at 23:26 on Dec 3, 2016

CarForumPoster
Jun 26, 2013

⚡POWER⚡

Sagebrush posted:

Sounds reasonable as long as you have some way of accurately timestamping the output and input, and the timescales you're concerned about aren't so short that you run into issues with serial communication lag or just running faster than the Arduino can keep up with. Since you're talking about relays I assume the measurements are on the order of tens to hundreds of milliseconds, which shouldn't present any problem if you use interrupt code.

How do you talk to the relay control board? Ideally, you'd do all of the I/O in a single program so that you don't have to worry about synchronization. You write a Python script or whatever that triggers the relay through whatever protocol it uses, starts a timer, watches the serial port for the Arduino's response, stops the timer and stores the value.

e: voltage monitoring may be challenging as there is some lag in reading the ADC (microseconds, but it's enough that you can miss small transients). Depending, again, on the scale of what you're measuring, you might not be able to get useful data there. An Arduino isn't a good replacement for a storage oscilloscope.

The time scale thing is a bit of an issue and I'm mulling over whether theres some way I can make a timeserver for the test computer and the arduino so they both know what time it is or maybe just run an RTC on the arduino. (I just learned that was a thing today)

The relay control board has an FTDI chip on it that actuates the relay and coms over USB. I connect to the board from an ubuntu laptop->USB cable->board and use a Python script that uses PyUSB on top of lib-usb that sends the commands.

The bash script that runs them can be thought of as:
python relay.py -relay 5 -on
sleep 0.5
python relay.py -relay 5 -off

What you describe is how I picture it and what I will learn to do over Christmas I hope. I am not concerned with voltage transients as most of the time scales I am looking at are in the half second or greater range. The relay actuates in ~20ms and I don't care if I miss it.

huhu
Feb 24, 2006
Cross posting from the electronics thread:

Anyone here know electrical engineering terms in Spanish? I'm teaching an electronics class in Colombia next month and I have no idea how to translate words like "to short" and breadboard to Spanish.

Trabisnikof
Dec 24, 2005

huhu posted:

Cross posting from the electronics thread:

Anyone here know electrical engineering terms in Spanish? I'm teaching an electronics class in Colombia next month and I have no idea how to translate words like "to short" and breadboard to Spanish.

Have you tried Spanish language Wikipedia?

huhu
Feb 24, 2006

Trabisnikof posted:

Have you tried Spanish language Wikipedia?

No, but I imagine it wouldn't just be a list of vocabulary? I already have technical documents in Spanish but I'd rather not hunt through for various words to prepare my PowerPoint presentation.

Hadlock
Nov 9, 2004

I once bought an English/German/Spanish marine dictionary. Surely something exists.

English marine terms include stuff like batten, bowsprit, boom, mizzen, block, jib, jybe, tack, vang etc etc and is different in every language.

Maybe look for an English/Spanish engineering dictionary

GobiasIndustries
Dec 14, 2007

Lipstick Apathy
https://www.amazon.com/Dictionary-Engineering-English-Languages-Technical/dp/123587110X/ref=sr_1_1?ie=UTF8&qid=1481308920 ?

e: Here's one that's electronics focused apparently: https://www.amazon.com/Spanish-English-Dictionary-Electricity-Electronics/dp/1418063444

Hubbins
Sep 3, 2007
THIS is what a Hubbins looks like.
Through a series of mishaps I managed to desolder and lose the R2 resistor to my arduino pro mini. I've looked at the schematic and I see it is a pull up resistor on the reset pin. It does look like there is an additional connection to VCC on that line as well. Do I need to replace the resistor or can I ignore it?

B-Nasty
May 25, 2005

Hubbins posted:

Through a series of mishaps I managed to desolder and lose the R2 resistor to my arduino pro mini. I've looked at the schematic and I see it is a pull up resistor on the reset pin. It does look like there is an additional connection to VCC on that line as well. Do I need to replace the resistor or can I ignore it?

I'm not sure what you mean about a additional connection to VCC on the reset line. The other pins tied to VCC cross over that pin; they aren't connected (with a dot.)

AVR chips have the RESET pin pulled high internally, so you don't technically need to replace that resistor. That said, the recommend it for noisy environments. If you do replace it, don't go lower than 10K ohms, because your programmer might not be able to pull that pin low to program the chip. From the docs:

quote:

The reset line has an internal pull-up resistor. If the environment is noisy, it can be insufficient and reset
may occur sporadically. Refer to the device datasheet for the value of the pull-up resistor that must be
used for specific devices.
Connecting the RESET so that it is possible to enter both high-voltage programming and ordinary low
level reset can be achieved by using a pull-up resistor to the RESET line. This pull-up resistor avoids any
unintended low signal that will trigger a RESET. Theoretically, the pull-up resistor can be of any value, but
if the Atmel AVR should be programmed using an external programmer, the pull-up should not be in such
a high state that the programmer is not able to activate RESET by drawing the RESET line low. The
recommended pull-up resistor value is 4.7kΩ or larger when using STK®
600 for programming. For
DebugWIRE to function properly, the pull-up must not be less than 10kΩ.


http://www.atmel.com/images/atmel-2521-avr-hardware-design-considerations_applicationnote_avr042.pdf

Hubbins
Sep 3, 2007
THIS is what a Hubbins looks like.
How did I miss that it was a crossover and not connected. An internal pullup is good enough for my needs at the moment but I'll look into replacing it in the longer term. Thanks.

Edit: With some impromptu flux and a bit of luck I managed to solder the SMD resistor back into place. It looks terrible but everything works as it should.

Hubbins fucked around with this message at 01:01 on Dec 21, 2016

huhu
Feb 24, 2006
drat that's awesome, thanks for searching.

politicorific
Sep 15, 2007
New project! I found one of those $10 Bluetooth speakers (s10) with a dead battery. It has the annoying English voice. I'd like to rip the eeprom and replace the sound files with my own. The eeprom is an 8pin 25Q80A SPI chip. I looked, but couldn't find any good tutorials, has anyone ever seen a project like this before?

From what I've read, I shouldn't have to desolate the chip, and should be able to dump everything over serial console. Then I guess it's a matter of manipulating the data until I can get it to play in audacity.

Hadlock
Nov 9, 2004

Reminder: all of those $25 solar powered rechargable battery LED Christmas lights at Big Lots are now $8. They use an 18650 lithium ion battery :dance:



Hadlock fucked around with this message at 16:59 on Dec 25, 2016

coyo7e
Aug 23, 2007

by zen death robot
sup thread, I got an Arduino starter kit from adafruit for xmas, and have been poking along through its activities a little but I'm stumped on one of the early ones.. I'm pretty sure I sure I plugged it all in right and it seems as though whether I write the code myself or copy-paste it in, ze goggles still do nothink. :thejoke:

In theory I am supposed to have a dc motor spin up for a second or two, then shut off for a second or two, rinse repeat. In practise though, the board flickers for a half-second or so and then nothing happens. I took it apart and put it back together twice and I am just stumped. I tested the motor and it works.

The red and black leading off to the left go to the motor.


the code I'm using is this http://www.oomlout.com/oom.php/products/ardx/circ-03

or to cut out the garbage I was just using
code:
int motorPin = 9;
void setup() 
{
  // put your setup code here, to run once:
pinMode(motorPin, OUTPUT);
}

void loop() 
{
  // put your main code here, to run repeatedly:
motorOnOff();
}

void motorOnOff()
{
int onTime = 2500;
int offTime = 1500;

digitalWrite(motorPin, HIGH);
delay(onTime);

digitalWrite(motorPin, LOW);
delay(offTime);
}
Am I missing something obvious? I am jumping in the deep end with this stuff during xmas break because I am trying to move ahead of schedule in my building controls classes, and since I have only a rudimentary understanding of the electronics I feel like I may be missing something simple. Help me get my motor running!

Dynamite Dog
Dec 12, 2012

coyo7e posted:

In theory I am supposed to have a dc motor spin up for a second or two, then shut off for a second or two, rinse repeat. In practise though, the board flickers for a half-second or so and then nothing happens. I took it apart and put it back together twice and I am just stumped. I tested the motor and it works.

What power source did you use to test the motor? It could just be pulling too much power from your USB port to run the motor. If you have a multimeter you can also stick this in the circuit to see how much current the motor is drawing.

One thing you could do to narrow down your issue is add some rudimentary debugging to see if the program is executing but not doing what you want, or if it is somehow not executing (usually due to a constant restart). Since you're on USB you could do it two different ways pretty quickly. Either add some lines to blink the onboard LED before you try to run the motor, or send a serial command over USB (if you're following a guide you've probably done one of these things already).

It is also never a bad idea to make sure everything is connected securely and in the right orientation. This is especially true with diodes and transistors.

evil_bunnY
Apr 2, 2003

Put a voltmeter (or led and resistor in series) where the D.C. Motor should go and check that it lights up.

This stuff will work your analytical skills as hard you let it because it's a combo of code and IRL hardware. Keep that in mind when debugging.

coyo7e
Aug 23, 2007

by zen death robot
Awesome thanks guys, I've got an analog and digital multimeter and have been looking for an excuse to learn how to read them. I deconstructed everything for now and went back through the first two activities that came with the beginner set, except I just did them by eyeball from what I've learned so far, and it gave me a little more confidence that I was putting things together right, when I was able to put together an array of a half-dozen LEDs and get them to turn on and off in whatever order I felt like.

I have a 9V battery adapter that I tried adding in on the board in hopes it would add more juice for the motor but it still doesn't seem to do a darn thing. I touched the motor leads to the battery directly and it works fine, and I assumed that the 5V off the board would be enough. But like I said I'm pretty wet behind the ears so I'm still in that spot where I'm not sure if I did something wrong or not. If nothing else I'm knocking the rust off of the doors on my C coding experience, and with a week or two before classes start I'm hoping to get going well enough to talk to one of my advisors and maybe get into a Direct Digital Controls class next semester while most of the folks in my year are still working on learning how to build spreadsheets, what a computer network is, and the fundamentals of programming.. The main thing holding me back is not knowing what I need to know coming into the class, like maybe some HVAC systems or lighting math or something. ;)

evil_bunnY
Apr 2, 2003

You can't add the juice of a 9V like that. But you can use a digital pin to toggle a transistor on your 9V circuit.

Dynamite Dog
Dec 12, 2012

evil_bunnY posted:

You can't add the juice of a 9V like that. But you can use a digital pin to toggle a transistor on your 9V circuit.

This is a good idea in general, and how you will want to run most Arduino projects with any kind of motor. The board may have the right voltage but current is what makes your motors work (or not work).

e- The power/current/voltage relationship is definitely something you will want to look into if you're trying to get past some intro classes.

Dynamite Dog fucked around with this message at 19:46 on Dec 27, 2016

coyo7e
Aug 23, 2007

by zen death robot
^^^ Yeah the relationship between those and the terminology and math is something I'm struggling to inhale as much as possible, because the way my classes are set up right now, I will only be taking PHY 102 this next semester, but the curriculum is heavily-padded first year to give people a lot of basic computer know-how (the program is mainly set up to assume people are construction background or no background) before there are classes to tear down equipment and put it back together second year - almost 9 months after I'll presumably forget a bunch of my PHY 102 stuff :( , and they don't even require a basic electronics class, so it's kind of hazy as to how much I need to know for some of the later classes.. Energy audits are fun and all but aside from figuring out how to calculate the Btus required to top off and heat up my water heater, a lot of the actual electrical/electronics stuff seems to be getting passed over outside of the HVAC and Solar classes.

Newbie question - why do I have 3 ground channels on my Uno? There's two on the power side and one by the digital channels, I assume it's for convenience but is there any difference between them?

coyo7e fucked around with this message at 20:41 on Dec 27, 2016

coyo7e
Aug 23, 2007

by zen death robot

Dynamite Dog posted:

What power source did you use to test the motor? It could just be pulling too much power from your USB port to run the motor. If you have a multimeter you can also stick this in the circuit to see how much current the motor is drawing.

One thing you could do to narrow down your issue is add some rudimentary debugging to see if the program is executing but not doing what you want, or if it is somehow not executing (usually due to a constant restart). Since you're on USB you could do it two different ways pretty quickly. Either add some lines to blink the onboard LED before you try to run the motor, or send a serial command over USB (if you're following a guide you've probably done one of these things already).

It is also never a bad idea to make sure everything is connected securely and in the right orientation. This is especially true with diodes and transistors.
Can you put in a diode backward? I assume they're bi-directional like a resistor (except in terms of keeping stuff easy to read at a glance).

Anyways I reassembled the whole thing with a little more understanding and found out: that my digital multimeter has faulty leads :dawkins101: , and also that having an alaog backup is always a good idea..! So I'm pulling a solid 5V at every point I checked and it's only a 6V motor. I also changed to pin 13 so I could use the LED connected to it to make sure the code was working - which it seems to be. Damned motor still won't move to save my life unless I touch it directly to a 9V, so from my limited understanding, it must not be receiving enough power to advance. Not really sure where to go from here since I don't know how to try much else, or add more power somehow. Kind of frustrating to be stuck and not know which direction to go on from.

I guess I'm confused by how the transistor and diode work here.. I understand the schematic for the most part I think, except for the part where the collector passes through to the motor in-line between the positive current and the diode, which seems weird to me, I guess I am having trouble envisioning how the transistor is switching current. I found a much-cleaner version of the same tutorial and I was able to get the motor to come on (accidentally by putting a ground in the wrong spot) but it just revs up and keeps going - there's obviously no logic involved because pin 13 is still lighting up over and over.

I'm using this now, but it just seems to fall apart from the transistor's collector to the motor, I put in a test LED at each stage, and it never turns on down by the collector, although everything before the transistor is gravy. I guess I don't grok this transistor thing yet, even though it seemed pretty straightforward :saddowns:

coyo7e fucked around with this message at 01:55 on Dec 28, 2016

Platystemon
Feb 13, 2012

BREADS

coyo7e posted:

Can you put in a diode backward? I assume they're bi-directional like a resistor (except in terms of keeping stuff easy to read at a glance).

Diodes act like one‐way valves. Their orientation matters.

coyo7e
Aug 23, 2007

by zen death robot

Platystemon posted:

Diodes act like one‐way valves. Their orientation matters.
Awesome thanks, I understand their function but didn't realize that. Either way it wasn't the problem with my motor attempts.. I got it figured out and working right, and blew through the next activity (servos) in about 5 or 10 minutes.

Also I went to wal-mart today and they had a whole load of those solar LED yard lights on sale for 92 cents a pop, so I bought a few of them and plan on making a battery pack out of the triple-As - maybe I can use the PVCs to keep my wireless doorbell going, because it seems to die pdq with the tiny battery it runs on.

Aurium
Oct 10, 2010

coyo7e posted:

I guess I'm confused by how the transistor and diode work here.. I understand the schematic for the most part I think, except for the part where the collector passes through to the motor in-line between the positive current and the diode, which seems weird to me, I guess I am having trouble envisioning how the transistor is switching current. I found a much-cleaner version of the same tutorial and I was able to get the motor to come on (accidentally by putting a ground in the wrong spot) but it just revs up and keeps going - there's obviously no logic involved because pin 13 is still lighting up over and over.

Other people have fixed your problem, so I'll talk about the purpose of the components.

The transistor works as a switch.

The motor has a coil inside it, when current goes though it the shaft spins.

When current stops flowing though a coil, the coil generates a voltage with the opposite polarity of the original voltage. It can also be much higher than the original voltage. This high voltage can damage the transistor.

The diode protects the transistor by shorting out this voltage. Because the generated voltage is reversed with respect to the operating voltage you put the diode in "backwards" compared to the power supply.


coyo7e posted:

Newbie question - why do I have 3 ground channels on my Uno? There's two on the power side and one by the digital channels, I assume it's for convenience but is there any difference between them?

Convenience. On the arduino there's no practical difference between them. There are some circumstances when you'd have different grounds for different things, but that's the definitely the exception.

coyo7e
Aug 23, 2007

by zen death robot
TYVM, I didn't realize that the "back-blast" of stopping could spike up like the initial push could, or that I'd need to protect the transistor from it!

Collateral Damage
Jun 13, 2009

I like to compare inductive loads (motors, solenoids and other things that use induction coils) to a spring. While you're supplying current you're compressing the spring. Remove the current and the spring will kick back out past its original size due to inertia. The diode works like a damper.

coyo7e
Aug 23, 2007

by zen death robot
That's a great analogy thanks!

Also I'm pretty sure I figured out largely why I was screwed on that motor experiment.. I was using a TMP36 temperature sensor because it looked identical to my transistors :D

I had no idea that I even had a temp sensor until I had to hunt for it on a temp-based project from my ardx kit

TheresaJayne
Jul 1, 2011

Collateral Damage posted:

I like to compare inductive loads (motors, solenoids and other things that use induction coils) to a spring. While you're supplying current you're compressing the spring. Remove the current and the spring will kick back out past its original size due to inertia. The diode works like a damper.

Back EMF is also one of the crackpot ways people seem to believe they can create power from nothing.

https://www.youtube.com/watch?v=k7CTmmI3i1c

simplefish
Mar 28, 2011

So long, and thanks for all the fish gallbladdΣrs!


Collateral Damage posted:

I like to compare inductive loads (motors, solenoids and other things that use induction coils) to a spring. While you're supplying current you're compressing the spring. Remove the current and the spring will kick back out past its original size due to inertia. The diode works like a damper.

:iiaca:

cakesmith handyman
Jul 22, 2007

Pip-Pip old chap! Last one in is a rotten egg what what.

Hello thread, I've a project in mind and wondered if an arduino was the right way to go with it. I want to control Lego contraptions without a PC. Years ago I'd have used the RCX controller I got with a mindstorms kit, but it's very limited (3in/3out) and to program it now would require faffing about with Windows 98 and obsolete patches.

All the sensors and motors are 9v and I'm happy to modify cables to connect one system to the other but before I start is an arduino variant the best thing to start with? Can they drive motors in 2 directions natively or do they need external motor driver boards?

Adbot
ADBOT LOVES YOU

Collateral Damage
Jun 13, 2009

You'll want a motor driver board regardless because the Arduino doesn't provide enough juice to power the motors on its own, especially not 9v motors.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply