Offline
Newbie
Karma: 0
Posts: 5
|
 |
« on: November 17, 2012, 03:36:31 am » |
Hi, I wonder if anybody might have a clue to what has happened ? I am trying to run a 12 volt vehicular relay off an arduino uno and am using the 13 pin and the ground pins (2) on the power out! I am running the pin 13 through a 330 ohm resistor and an optocoupler to a mini relay and the vehicle relay from this (mini relay) the idea is to programme the vehicle relay to fire (high) at say 4 secs and then (low) off for say 10seconds. I have programmed the arduino with an LED using the ground and 13 pin adjacent on the pin 13 bus and when I connect the relays etc in to the Arduino, the veh relay works (happily clicking on and off) but it only works at the same timing as the standard Uno indicator light speed ie around .5 high and say .5 low? can you please tell me have I blown something or should I re-programme the arduino to read relay instead of Led? and call the new programme something else? if so any advice re any new programme would be very gratefully recieved Thanks in anticipation, Rob, UK junction 9,M25
|
|
|
|
|
Logged
|
|
|
|
|
Cape Town South Africa
Offline
Edison Member
Karma: 17
Posts: 1104
A newbie with loads of posts, and still so much to learn !
|
 |
« Reply #1 on: November 17, 2012, 03:44:47 am » |
can you post the code ( highlight it and click on the # button to display it in a panel )
|
|
|
|
|
Logged
|
We live in the era of the smart phones and stupid people.
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 5
|
 |
« Reply #2 on: November 17, 2012, 04:19:51 am » |
Hi Karma8 I am like many "new to Arduino users" I suspect, and am totally over-awed by its capability and flexibility. I now have it working as I want it to, thankyou so much for your kind offer. What I think happened, is that somehow the Aeduino didn`t recognose (as its own) the port that I usually use for it ie port 5 ( the easiest for me as iuts in the front of my PC) and it automatically thought it should be in 1? and I missed that, so as soon as I changed it to 5 it fired up OK and I managed to reprogramme it.
As I am a novice to the programming, I wonder if I can take you up on your kind offer, (I don`t know how to paste the programme as yet to the forum, but will soon find out I guess) I won`t waste your time I assure you,
What I am doing with the Arduino is using a single unit to operate a "burst" pump system using a solenoid valve "teed" off a peristaltic high (ish) pressure system and it works fine with a small 555 timer system at present, but I need to be able to change the bursts timing as the system calls for it ie micro secs etc I have as yet to sort the needed Arduino inputs etc and its early days as yet . Thanks again for your kind offer and help KIndest regards Rob.
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 278
Posts: 25577
Solder is electric glue
|
 |
« Reply #3 on: November 17, 2012, 04:35:57 am » |
I am not sure how those two posts relate to the request for your code.
When asking a question it is best to use sentences with full stops at the end at leasrpt. In case you have run out of them here are some to copy and paste ..................................................
|
|
|
|
|
Logged
|
|
|
|
|
Cape Town South Africa
Offline
Edison Member
Karma: 17
Posts: 1104
A newbie with loads of posts, and still so much to learn !
|
 |
« Reply #4 on: November 17, 2012, 05:36:31 am » |
our US members might find ".................................................." an explanation of the "Grumpy" Mike ??? :-)
(for others , English speakers call them "full stops" )
|
|
|
|
|
Logged
|
We live in the era of the smart phones and stupid people.
|
|
|
|
UK
Offline
Tesla Member
Karma: 89
Posts: 6415
-
|
 |
« Reply #5 on: November 17, 2012, 09:25:14 am » |
I have programmed the arduino with an LED using the ground and 13 pin adjacent on the pin 13 bus and when I connect the relays etc in to the Arduino, the veh relay works (happily clicking on and off) but it only works at the same timing as the standard Uno indicator light speed ie around .5 high and say .5 low?
Pin 13 is connected to the onboard LED to the LED will light whenever pin13 is high. If it's blinking at 0.5 seconds high and 05 seconds low then presumably that's what the sketch is telling it to do. Arduinos typically come with a 'blink' sketch preloaded so it is easy to just plug it in and see it do something, but when you want to define your own behaviour you would need to write and upload your own sketch. Have you done that? If so, please post the code.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 5
|
 |
« Reply #6 on: November 17, 2012, 09:36:34 am » |
int ledPin = 13; void setup() { pinMode(ledPin, OUTPUT); } void loop() { digitalWrite(ledPin, HIGH); delay(1000); digitalWrite(ledPin, LOW); delay(1000); }
.................................................Full Stops (if needed)................................................. The above code seemed to work after the initial problem with the port selection, but now I would seem unable to change the low and high periods? from what I initially set them at, around:- low 10 secs and high 1 "sec" (thats short for seconds, GM) Any Ideas as to what I may be doing wrong? Other than grammatical errors? would be most gratiously recieved. Thanks in anticipation.
|
|
|
|
|
Logged
|
|
|
|
|
Cape Town South Africa
Offline
Edison Member
Karma: 17
Posts: 1104
A newbie with loads of posts, and still so much to learn !
|
 |
« Reply #7 on: November 17, 2012, 10:32:08 am » |
digitalWrite(ledPin, HIGH); // switches on the LED delay(1000); // waits for 1000 milliseconds = 1 second, then :- digitalWrite(ledPin, LOW); // switches off the LED delay(1000); // waits for 1000 milliseconds again = 1 second,
|
|
|
|
|
Logged
|
We live in the era of the smart phones and stupid people.
|
|
|
|
California
Offline
Edison Member
Karma: 41
Posts: 1888
|
 |
« Reply #8 on: November 17, 2012, 10:51:16 am » |
The above code seemed to work after the initial problem with the port selection, but now I would seem unable to change the low and high periods? from what I initially set them at, around:- low 10 secs and high 1 "sec" (thats short for seconds, GM) Any Ideas as to what I may be doing wrong? Other than grammatical errors? would be most gratiously recieved. Thanks in anticipation.
So the posted code works, you made modifications to it which you aren't going to show and the new code "doesn't work"? Start by posting the code that doesn't work using the CODE tags, telling us what you are expecting it to do and what it is doing.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #9 on: November 17, 2012, 12:45:13 pm » |
Apologies for the confusion. I split the topic when I thought (wrongly) the second post related to a different topic. @OP, calling other members by their karma rating is tricky, for karma ratings, unlike stock prices, can only stay the same or go up.
@GM, the M25 is a fractal because, although it bounds a finite area, it take an infinite time to traverse, meaning it must be infinitely long.
|
|
|
|
« Last Edit: November 17, 2012, 12:49:38 pm by AWOL »
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Cape Town South Africa
Offline
Edison Member
Karma: 17
Posts: 1104
A newbie with loads of posts, and still so much to learn !
|
 |
« Reply #10 on: November 17, 2012, 01:20:18 pm » |
@AWOL
I thing junction 9 is the number of one of the parking bays in the M25 car park.
|
|
|
|
|
Logged
|
We live in the era of the smart phones and stupid people.
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 5
|
 |
« Reply #11 on: November 18, 2012, 03:49:06 am » |
Boffin 1, you are right Junction 9 is almost a car parking space off the M25 motorway  . I think that I have it sorted now? code wise, however I am not completely sure. What I would like to do is programme the recipient relay to fire more than once, i,e, fire four times in quick succession (say 0050) and then rest for say 8(ooo) secs, but am not sure how to build multiple delays into the programme. The fast talking and very capable US lads in their tutotials ( AKA Mr Blom mainly) leave me behind from the start. Doh! I guess I`m just thick. Is there an existing site where I can copy and paste a similar existing programme and doctor it to suit? thanks for your help so far.
|
|
|
|
|
Logged
|
|
|
|
|
Cape Town South Africa
Offline
Edison Member
Karma: 17
Posts: 1104
A newbie with loads of posts, and still so much to learn !
|
 |
« Reply #12 on: November 18, 2012, 05:02:30 am » |
digitalWrite(ledPin, HIGH); // switches on the LED delay(50); // waits for 50 milliseconds = 0.02second, then :- digitalWrite(ledPin, LOW); // switches off the LED delay(50); // waits for 50 milliseconds again = 0.02 second, digitalWrite(ledPin, HIGH); // switches on the LED delay(8000); // waits for 8000 milliseconds = 8 second, then :- digitalWrite(ledPin, LOW); // switches off the LED delay(1000); // waits for 1000 milliseconds again = 1 second, delay ( 60000 ); // wait 1 minute
and so on
|
|
|
|
|
Logged
|
We live in the era of the smart phones and stupid people.
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 5
|
 |
« Reply #13 on: November 18, 2012, 06:56:08 am » |
Thanks so much for that "Boffin 1" I am nost grateful! I will copy and paste (deleting the indication statements) and let you know what Happens, thank you so much once again Kind regards Rob.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #14 on: November 18, 2012, 07:53:09 am » |
waits for 50 milliseconds = 0.02second Novel.
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
|