When you click on links to various merchants on this site and make a purchase, this can result in this site earning a commission. Affiliate programs and affiliations include, but are not limited to, the eBay Partner Network.
On the left side, black is ground (grnd) pin and red is VCC pin. On the right side, pin 7 (d7) is the signal pin that your pwm signal will come out of and pin 9 (d9) is the pin your button will attach to. You can see both of these values set in the first couple of lines of the code. You can change these pins to whatever you want as long as they are the digital pins on the Arduino, but for simplicity, just leave it as it is.
const int _pwmPin = 7; //pin7 on board const int _buttonPin = 9; // pin9 on board
By the way, I was able to download and use the pwm library that's linked in my original post on an Uno just fine. The code compiles and uploaded to the uno fine.
It is still completely unclear which pins to connect to - the pic you attached is blurry on a HD 20" hi rez monitor
On the Uno - not nano - which pin does the green wire connect to?
Which pin for the blue wire?
Last edited by Argentimage; Aug 7, 2020 at 08:17 AM.
On the left side, black is ground (grnd) pin and red is VCC pin. On the right side, pin 7 (d7) is the signal pin that your pwm signal will come out of and pin 9 (d9) is the pin your button will attach to. You can see both of these values set in the first couple of lines of the code. You can change these pins to whatever you want as long as they are the digital pins on the Arduino, but for simplicity, just leave it as it is.
const int _pwmPin = 7; //pin7 on board const int _buttonPin = 9; // pin9 on board
By the way, I was able to download and use the pwm library that's linked in my original post on an Uno just fine. The code compiles and uploaded to the uno fine.
As I said in my previous post, the pins that you connect to on the uno are labeled vcc for positive, gnd for ground d9 for your button and d7 for your signal. If you look on your uno, right next to the pins is a label, just connect to the pins I have listed here.
I'm not sure where you got pin 2 from. You should have constant power (+)y going into the VCC pin on your Arduino. Ground going into the ground pin on your Arduino. Your signal comes out of the Arduino on pin digital pin 7 (d7) and your button should connect to digital pin 9 (d9). Those are the only pins involved. D7 will always have a voltage across it, but it'll be close to 0 when the duty cycle is at 20% and close to 5v when at 80 % duty cycle.
Apologies, I thought we were talking about the Arduino still. Yes, pin 2 on the actuator will have voltage all the time. It will fluctuate depending on duty cycle (if you are looking at it with a multimeter) between close to 0 and 10v.
well there is something terribly wrong with this - how about posing picture of you board???
The first one could not get it to power at the barrel connection - and they are real italian cover boards --
so I used the USB - the orange light flashed no on each touch of the momentary switch -- however when it did, there was no valve action then it stopped, not consistent in the flash on momentary switch - like maybe once in ten, so I spend a good deal of time like three hours making up a second board.
The second and third ardunio UNO's fried at the USB connection on plug in - so something is wrong - short to ground.
I do not doubt you have it working but something is really flawed in these instructions,
I'd really like to see your layout
then
what is the purpose of the resistors across ground and 1.5k and 1k values?
I should see a resistance difference with a multimeter? 10k ohm may either be at limit to measure thus cannot or it isnt 10k ohm...
I can take a picture of my board for you tomorrow. I'll put the circuit together on a breadboard also so you can see the connections a little clearer. The 1k and 1.5k resistors to ground are what's called a voltage divider, https://en.m.wikipedia.org/wiki/Volt...0the%20divider . Basically it's taking the 12 volts out of the voltage regulator and stepping it down to 10 volts that the actuators require.this circuit is very simple. Please post a picture of what you have and I'll try to look at it too.
Question - does the signal trigger the valve to move back forth or just 25%, that is a quarter turn each time it is triggered?
And then.. to the wiki Ohms law formula pasted in...you said we want to drop 12v to 10v, that is a 5/6 ratio, yes? Yes.
How do the 1.5 and 1 ohm resistors figure in to a 5/6 ratio?
The on line calculators say 1 K Ohm and 5k Ohm on two resistors - why is this using three?
Last edited by Argentimage; Aug 10, 2020 at 01:03 PM.
Question - does the signal trigger the valve to move back forth or just 25%, that is a quarter turn each time it is triggered?
And then.. to the wiki Ohms law formula pasted in...you said we want to drop 12v to 10v, that is a 5/6 ratio, yes? Yes.
How do the 1.5 and 1 ohm resistors figure in to a 5/6 ratio?
The on line calculators say 1 K Ohm and 5k Ohm on two resistors - why is this using three?
It's not using 3 resistors for the voltage divider, only 2. The entire blue line is 10v because the 1.5k and the 10k dump voltage back to ground (this is the voltage divider). The 1k resistor after is just an inline resistor on what is now a 10v leg of the circuit on it's way to the transistor.
I am asking back forth left right movement?
What is reversing the current?
YEAH, I've seen that calculator, and there is a ready made board out there to do this....and that seller said it s a 5/6 ratio...and the Ohm law would look to be 5/6 ratio... thats why the questions go deeper.
12v in
10k Ohm Resistance 2
if we want 10v out the calculator returned 2 yesterday, and 2 today too. Why is it 1.5 on the board?
Last edited by Argentimage; Aug 11, 2020 at 07:32 AM.
I' sent you a message to your inbox. I built the circuit for you with an Uno and I figured out why yours isn't working.
Iyou are welcome to experiment and come up with your own solution using a pre made voltage divider of you choose. I wouldn't do it that way. You can also buy 10v voltage regulators, etc. But they are less common. Your solution is a very simple one. Pin 7 on an Uno doesn't generate pwm signals you need to switch pin7 and pin9 in the code and in your circuit. Since my instructions used a nano and I hadn't built this circuit with an Uno. I didn't know that was the issue. I will update the instructions later to be more generic, but, the issue isn't the voltage divider circuit, it's the choice of using the uno and not the nano as described.
I have revised the schematic to hopefully make the circuit more clear. I have also included an Arduino Uno in place of the nano used previously because maybe the larger form factor of the UNO is more accessible. Both Uno and Nano will work fine. Also, I have revised the code slightly to send pwm over pin 9 on the uno/nano. I've also included a second wired momentary button in the schematic for those that don't want a wireless option.
Last edited by CityOf9Gates; Aug 11, 2020 at 11:14 AM.
Im getting this error code:
SUggestions on how to solve?
SKETCHES THAT COULD NOT BE IMPORTED:
[PWM] Error: no ino file
[utility] Error: no ino file
[PWM_lib_example] There's already a sketch with this name in your Sketchbook, please rename it and try to import again.
[PWM_lib_resolution_example] There's already a sketch with this name in your Sketchbook, please rename it and try to import again.
Im getting this error code:
SUggestions on how to solve?
SKETCHES THAT COULD NOT BE IMPORTED:
[PWM] Error: no ino file
[utility] Error: no ino file
[PWM_lib_example] There's already a sketch with this name in your Sketchbook, please rename it and try to import again.
[PWM_lib_resolution_example] There's already a sketch with this name in your Sketchbook, please rename it and try to import again.
then when I upload and save, this error:
PWM.h no such file or directory
down further it says compiliation terminated
all this is in red:
Detecting libraries used...
/tmp/190827772/sketch_aug19b_copy/sketch_aug19b_copy.ino:1:10: fatal error: PWM.h: No such file or directory
#include <PWM.h> // pwm-frequency-library #include <EEPROM.h> const int _pwmPin = 9; //pin9 on arduino board const int _buttonPin = 7; // pin7 on board bool _isRunning = true; bool ReadValveState() { int valveSt = EEPROM.read(0); //read the last valve state from memory if (valveSt == 1) { return true; } else { return false; } } void DoOpenValves()//sends a pwm signal to valves causing them to open { pwmWrite(_pwmPin, 203); } void DoCloseValves()//sends a pwm signal to valves causing them to close { pwmWrite(_pwmPin, 51); } void setup() { InitTimersSafe(); SetPinFrequencySafe(_pwmPin, 200); //sets the pwm pin frequency to 200 Hz pinMode(_pwmPin, OUTPUT); // sets the pwm pin as an output pin pinMode(_buttonPin, INPUT_PULLUP); //sets the input pin for the button pinMode(LED_BUILTIN, OUTPUT); if (ReadValveState() == true) //initialize the valves to the last state (if the valves were open when the car was turned off, the valves will be open when the car is turned on, etc { DoCloseValves(); } else { DoOpenValves(); } _isRunning = false; } void loop() //the main body of our arduino code, this is run over and over as long as there is power { if (_isRunning == false) //this is to prevent repeated button presses { if (digitalRead(_buttonPin) == LOW) //check the state of the button if it's pressed { _isRunning == true; if (ReadValveState() == true) //if the valves are closed, { EEPROM.write(0, 0); //set the new valve state and open the valves DoOpenValves(); } else //the must be opened { EEPROM.write(0, 1); //set the new valve state and close the valves DoCloseValves(); } FlashBuiltInLED(); // this will give a delay of 1 seconds this helps in debugging to know if your circuit is working when not connected to a valve. If your button is pressed and you see a flashing, then the button is triggering the open/close of the the valve pwm _isRunning == false; } } } void FlashBuiltInLED() { for (int i = 0; i <= 10; i++) { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on delay(100); // wait for tenth a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off delay(100); // wait for tenth a second } }/* */ void setup() { } void loop() { }