Hi Everyone.
I'm looking throught the documentation at the moment and have seen that someone added 12v power detection on one of the pins, I've heard it's been on D13 before..
I'm just starting out on my build, I'm planning on doing a full build using the DRV8825 love the idea having all the features. The 12v power detection is something that I was thinking about adding to the firmware.
The idea is that I'm going to add one more component a LM7805 Voltage Regulator to drop the 12v for the motor into 5v that can be read by the ardunio without risking blowing it up. Not sure if I need to include a resister. All I want it for is to be able to read the TTL voltage.
I'm planning on then modifying the sketch, so that this can be an option, in the same way as the temp probe, or the push buttons. It would be fantastic if one I've done the code changes there's some way of submitting it for @brownrb to review and maybe include in a future official release.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would recommend using ADC7 (A7) as it is a purely analog in pin and will not conflict with any of the other options such as Bluetooth or Rotary Encoder.
Remember that the max you can apply to a pin is 5V sp you will need to use a circuit divider from 12V to ADC7.
Then its just a matter of reading the ADC7 input pin, which gives a value from 0-1023, where each unit = 5/1024 = .004v
With 12V ON, then 5V appears at the pin giving a reading of 1023 or 4.995V
With 12V off, then there is no voltage on the pin giving a reading of 0
But there will be a catcha. When powering from 5V USB and 12V is not on, the NANO will supply 5V on the VIN pin. This feeds back through the circuitry.
Which means when 12V is off it will actually have 5V going into the divider network (not 12) thus the voltage on the pin will be about 2.4V? which is OK because that gives a reading a lot less than the 1023 that is returned when 12V is on.
Hope this makes sense. Only way is to breadboard and test.
A voltage divider network based on 12V, with 5V to ADC7 would be like diagram.
This gives when 12V ON a value of 4.5V to ADC7 of about 922 (lets say anthing over 900)
With 12V off, then there is a value of about 3V or about 614, so its easy then to detect if 12V is ON or OFF.
Mind you, if you applied more than 12V then thats an issue, so probably a zener might be a good idea.
Else you could use a seperate 7805 instead. That would NOT turn on if 12V was not applied, so you would have either 5V or 0V, so that is probably a cleaner solution.
Regards
Robert
All that is left then is setting a flag variable to 1 or 0 if the 12V is on and modifying the routines that move the focuser (case 5,28, 64) as well as push buttons, jogging, etc - to check the flag variable and if 1 then do the move else if 0 do nothing
Hi Robert.
That second circuit design looks great to me. Much better than the circuit that I was going to build. It also answers a question that I had for myself "do I need to put a load on the output as I'm only interested in the logic level?" The answer is nope, no load required.
Do do like the idea of adding the two capacitors, that help to debounce the circuit. I'm going to be going with the second circuit design, as I already have the LM7805 and like the idea that it's not as fussy with the input voltage. Which means it'll play nicer with a leisure battery, or PSU powering the 12v input, so the real voltage could vary a bit from 11v to 13.8v
I'll take a good close look at the code, and see about ADC7, I like the idea of something that other people can simply add with a define in the code, and yeah, I think that rather than checking for a 1023 I think it would be better to play nice with the TTL Logic level rules, so 0.8v or lower = low or 2v or higher = high. This will mean that the software has greater flexibility for people doing funky things.
To simplify, rather than go 100% to the TTL low state, I'm thinking that 2V being the switch from high to low. That makes a minimum high reading of 409.6, so let's round that to 410, and call it good enough. Means that people don't need to be as perfect if they make a volage divider. they could over egg the cake and not need to bother with the zenner as that kinda make's things complicated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I recommend ADC7 because it is the pin that will not conflict with any other option. If you choose a digitial pin then it means at least one or more options will conflict.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yep. I understand why that pin. I'm going to hang fire until the 278 release, then I'll start working on the code. It's going to be a while before I've got it working.
As for the circuit boards. My initial thoughts will be to create this on a bit of strip board, then connect the relevent wires to the main board. I'm going to do it this way, because I already ordered the full PCB. Might not look perfect from a production point of view, but I'm looking for functionality over asthetics.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Colin
I posted the 278 to the myArduinoDIY yahoo group for testing a few days ago.
Sounds like you have a good plan. Please keep us all informed of your progress as I am sure a lot of others are really interested in following your idea.
Regards
Robert
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Robert, I've had a change of mind about how I'm going to be working with my focusser once it's built. Having been looking at the power for my scope and the associated stuff, I've decided that I'm going to be running with the Bluetooth module. As I understand it, that means there will be no usb cable, so I won't need to think about connecting a 12v supply - it'll be required to make the box function in the first place.
Just wanted you to know why I've not been following up.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Everyone.
I'm looking throught the documentation at the moment and have seen that someone added 12v power detection on one of the pins, I've heard it's been on D13 before..
I'm just starting out on my build, I'm planning on doing a full build using the DRV8825 love the idea having all the features. The 12v power detection is something that I was thinking about adding to the firmware.
The idea is that I'm going to add one more component a LM7805 Voltage Regulator to drop the 12v for the motor into 5v that can be read by the ardunio without risking blowing it up. Not sure if I need to include a resister. All I want it for is to be able to read the TTL voltage.
I'm planning on then modifying the sketch, so that this can be an option, in the same way as the temp probe, or the push buttons. It would be fantastic if one I've done the code changes there's some way of submitting it for @brownrb to review and maybe include in a future official release.
All you need to do is post your circuit design, code and post progress here
:=)
Best regards
Robert
Author myFocuserPro2
Note: Firmware 278 will be out in a week or 2. We will be using this going forward.
Last edit: brownrb 2018-12-01
I would recommend using ADC7 (A7) as it is a purely analog in pin and will not conflict with any of the other options such as Bluetooth or Rotary Encoder.
Remember that the max you can apply to a pin is 5V sp you will need to use a circuit divider from 12V to ADC7.
Then its just a matter of reading the ADC7 input pin, which gives a value from 0-1023, where each unit = 5/1024 = .004v
With 12V ON, then 5V appears at the pin giving a reading of 1023 or 4.995V
With 12V off, then there is no voltage on the pin giving a reading of 0
But there will be a catcha. When powering from 5V USB and 12V is not on, the NANO will supply 5V on the VIN pin. This feeds back through the circuitry.
Which means when 12V is off it will actually have 5V going into the divider network (not 12) thus the voltage on the pin will be about 2.4V? which is OK because that gives a reading a lot less than the 1023 that is returned when 12V is on.
Hope this makes sense. Only way is to breadboard and test.
A voltage divider network based on 12V, with 5V to ADC7 would be like diagram.
This gives when 12V ON a value of 4.5V to ADC7 of about 922 (lets say anthing over 900)
With 12V off, then there is a value of about 3V or about 614, so its easy then to detect if 12V is ON or OFF.
Mind you, if you applied more than 12V then thats an issue, so probably a zener might be a good idea.
Else you could use a seperate 7805 instead. That would NOT turn on if 12V was not applied, so you would have either 5V or 0V, so that is probably a cleaner solution.
Regards
Robert
All that is left then is setting a flag variable to 1 or 0 if the 12V is on and modifying the routines that move the focuser (case 5,28, 64) as well as push buttons, jogging, etc - to check the flag variable and if 1 then do the move else if 0 do nothing
Last edit: brownrb 2018-12-01
Hi Robert.
That second circuit design looks great to me. Much better than the circuit that I was going to build. It also answers a question that I had for myself "do I need to put a load on the output as I'm only interested in the logic level?" The answer is nope, no load required.
Do do like the idea of adding the two capacitors, that help to debounce the circuit. I'm going to be going with the second circuit design, as I already have the LM7805 and like the idea that it's not as fussy with the input voltage. Which means it'll play nicer with a leisure battery, or PSU powering the 12v input, so the real voltage could vary a bit from 11v to 13.8v
I'll take a good close look at the code, and see about ADC7, I like the idea of something that other people can simply add with a define in the code, and yeah, I think that rather than checking for a 1023 I think it would be better to play nice with the TTL Logic level rules, so 0.8v or lower = low or 2v or higher = high. This will mean that the software has greater flexibility for people doing funky things.
To simplify, rather than go 100% to the TTL low state, I'm thinking that 2V being the switch from high to low. That makes a minimum high reading of 409.6, so let's round that to 410, and call it good enough. Means that people don't need to be as perfect if they make a volage divider. they could over egg the cake and not need to bother with the zenner as that kinda make's things complicated.
I recommend ADC7 because it is the pin that will not conflict with any other option. If you choose a digitial pin then it means at least one or more options will conflict.
Yep. I understand why that pin. I'm going to hang fire until the 278 release, then I'll start working on the code. It's going to be a while before I've got it working.
As for the circuit boards. My initial thoughts will be to create this on a bit of strip board, then connect the relevent wires to the main board. I'm going to do it this way, because I already ordered the full PCB. Might not look perfect from a production point of view, but I'm looking for functionality over asthetics.
Hi Colin
I posted the 278 to the myArduinoDIY yahoo group for testing a few days ago.
Sounds like you have a good plan. Please keep us all informed of your progress as I am sure a lot of others are really interested in following your idea.
Regards
Robert
Hi Robert, I've had a change of mind about how I'm going to be working with my focusser once it's built. Having been looking at the power for my scope and the associated stuff, I've decided that I'm going to be running with the Bluetooth module. As I understand it, that means there will be no usb cable, so I won't need to think about connecting a 12v supply - it'll be required to make the box function in the first place.
Just wanted you to know why I've not been following up.
Hi Coiln
FYI - A circuit has already been put in place and functional. All PCB's updated 10th Jan and firmware 280 directly supports this.
Regards
Robert
That's cool. Shame that I've already for the Rev 4 boards populated. I'm looking forward getting this project working