Hi Philip.
I'm replying to both questions here, the private email does not seem to work. Also, I think all questions are better asked openly, so others can learn from answers 😉
Answering in reverse, makes more sense:
Be sure to read this first:
https://makr.zone/tinyg-new-g-code-commands-for-openpnp-use/577/
The source is linked there, but for the ADC we have an issue open, see here:
https://groups.google.com/g/openpnp/c/0tcJh1ygayk/m/PfKPuYG7AgAJ
So if you want to use that, you need to use/start from their version.
I will try and integrate that into my version. Though I would
prefer if it was just a minor change, not upgrading all the Atmel
Studio environment.
Or better yet to go for an avr-gcc / Cmake build, that Ian has said is possible:
https://groups.google.com/g/openpnp/c/0tcJh1ygayk/m/2OO3ora8AgAJ
@Ian Arkver any news on that?
> Just a quick question since the internet yields me no results. I wanna use the SS2 pin for vacuum sensing, but I cant find if this pin is a 3.3v og 5v pin - so thats my first question.
That's not really an OpenPnP question 😁 Seems to be all 3.3V:
_Mark
--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/0ab5b2f4-16c7-435c-a874-95f490c40d9en%40googlegroups.com.
I translated it on my controller (also 3.3V). See the circuit,
and further justification for it, presented here:
https://makr.zone/vacuum-sensor/192/
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/b4ca7753-e35f-4764-a462-e099b0334ac3n%40googlegroups.com.
> Why are you OpAmping twice? Wouldnt you just be able to take the sensor output and divide it with 1k/2k Resistor to a 3.3v threshold and then OpAmp that?
That's actually described on the blog 😁:
I just had a dual op-amp in
DIL
laying around so I made the first one buffer the sensor
output, then used a R/2-to-R resistor divider to shift from 5V
to 3.3V, then used the second op-amp to buffer this. The
first op-amp is not really needed, if you just have a
single op-amp IC (pinout changes!).
I found it a nice (unintenced) side benefit to have the same
circuit deliver both a buffered 5V signal and a buffered 3.3V
signal, so users could use whatever fits their controller inputs.
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/d49b8d78-f7b7-4ae2-9e59-c9d4858eb281n%40googlegroups.com.
Your data sheet says 0.5mA max output, so you should use larger resistance 2k + 4k or more.
And yes, my use of opamp was mostly due to using the unmodified
capacitor + pullup thermistor input of the controller. And my
sensor could only output 0.1mA max.
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/6546001a-3c6d-4b98-896b-03d74d85023cn%40googlegroups.com.
What the... just noticed that I did not receive notifications
from GitHub. Will now catch up...
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/3fb2d0ad-39d2-4759-a1bc-950061ee6625n%40googlegroups.com.
Hi Philip,
the sensor indicates the vacuum level with the voltage on the output. According to the data sheet, it goes up to 4.6V (typ).
Now your resistor divider pulls that to GND, so 4.6V / (1k + 2k) = 1.53mA, i.e. three times too high.
This will hardly "smoke" the sensor, but it will likely lose
precision and perhaps stability (i.e. start to oscillate, drift
over time etc.). Plus it might age faster.
If you use 3.3k and 6.8k for instance, you get 4.6V / (3.3k +
6.8k) = 0.455mA, i.e. inside the specs.
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/5837ef1e-af1a-4c07-818a-e2bd546c98f6n%40googlegroups.com.
Hey Philip,
erm... I thought the ADC wasn't actually working??
https://github.com/markmaker/TinyG/pull/3#issuecomment-1440962921
> However, when the pump is turned off it hits the max value of 4096 and stays there. Do you have any idea why?
No. Unless you added a capacitor in parallel to the upper
resistor.
You should actually add a capacitor in parallel to the lower resistor. It smooths the signal and protects the IO pin against spikes/discharges. The larger the cap the slower the signal follows, but the more stability you get.
[sensor]--- long distance ---=---[ R ]---o-----o-----SS2 | upper | | | |R| _C__ | lower| | ____ | | | -o-------------------------------------o-----o-----GND
> With how I've understood raw ADC readings, 4096 / 3.3V = 1241 and therefor shouldnt my readings be somewhere around 600 to 900 range?
Can't follow you there.
1.8V*1241 = 2234
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/bcf33b35-c30f-4aa9-a4d5-2a89e9069700n%40googlegroups.com.
Of course!
While we're at cleaning that up, should we change it back to the
default? I assume using the internal ref is more
consistent, right?
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/b87b7121-07ce-45ea-9cf4-b4c248efd4bbn%40googlegroups.com.
> but it would change the values reported for
anyone already using it
I'm actually very confused about that.
When I made the ADC version, I believe I simply tested it
using VCC and GND. And there was a user wanting it, and saying
he'll test it, but never reporting back. Then Roman said it
doesn't work, he got the 100Hz pulse on the pin. Then Philip said
it, it does work and he gets a readings, albeit not taking
the VCC/1.6 range into account.
So maybe the 100Hz is some config option set wrong?
From what I know positively, nobody actually uses it yet, not as an established solution.
Regarding the ref voltage, analog supply (AVcc) is just connected to Vcc here:

So a matter of how noisy the VCC regulator is, given the input
side PSU noise (motors!) and output side load changes (no idea),
plus drift over time and temperature. The regulator U7 is not
specified here:
But I think I can read LM2594 off the IC:
https://www.ti.com/lit/gpn/lm2594Quarter century old design and titled "simple".
Maybe not as good as the internal ref, even with half the signal range. 😉
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/96f85a86-74a3-4b5b-ba8b-4b3d460c6556n%40googlegroups.com.
Hi Philip
> Is there any reason why https://github.com/markmaker/TinyG isnt linked at the bottom of https://makr.zone/tinyg-new-g-code-commands-for-openpnp-use/577/ with all the other links?
Good point, thanks. Done.
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/839bc802-c164-4ec3-9e41-dabbaba2f331n%40googlegroups.com.
> Also, regarding questions for firmware stuff, should I just make a new post? Given the title on this one is not accurate for that at all?
New post, thanks.
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/0466e3a0-0d8a-2dc8-18f3-802f126c2fae%40makr.zone.
> but it would change the values reported for anyone already using it
I'm actually very confused about that.
When I made the ADC version, I believe I simply tested it using VCC and GND. And there was a user wanting it, and saying he'll test it, but never reporting back. Then Roman said it doesn't work, he got the 100Hz pulse on the pin. Then Philip said it, it does work and he gets a readings, albeit not taking the VCC/1.6 range into account.
So maybe the 100Hz is some config option set wrong?
From what I know positively, nobody actually uses it yet, not as an established solution.
Hi kumme,
> use the vacuum sensing since months and I can confirm that there is no periodically 100 Hz pulse detectable on the SS2 pin not with sensor connected and not with sensor unconnected. I use Marks amplifier circuit.
Thanks for the clarification. This makes it more likely that some of the many $$ setting in TinyG actually enabled the 100Hz signal for Roman.
I may not understand correctly, but the following seems contradictory:
> I think the TinyG is not really made for analog
measurements. There are no blocking capacitors at the VCC Pins.
Especially the AVCC needs blocking capacitors, better with an
inductance in series.
... contradicts ...
> Using the VCC as reference should be fine. It is regulated and filtered and precision is not what we should be looking for.
.. as the two are directly connected on a TinyG.
I agree, but hard to do on an existing PCB, right?
> Capacitor with 10nF at the pinhead connector between SS2 and GND
Didn't we always say you need a capacitor? It is even on the picture:

https://makr.zone/tinyg-new-g-code-commands-for-openpnp-use/577/
_Mark
--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/a1fa77be-dc40-4a64-83b7-8d2a4846a91dn%40googlegroups.com.
> You/TheReza suggested a 1uF cap on the sensor input, which seems a lot to me. Klaus is suggesting 10nF which should provide some RF filtering while not adversely affecting the rate of signal change too much.
I agree, I felt the same way, but was not confident to overrule
TheReza's judgement, as the cap also protects the input,
and my knowledge there is very limited.
_Mark
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/30b8b166-e9f9-42f7-97dc-6e8160a8101dn%40googlegroups.com.
I may not understand correctly, but the following seems contradictory:
> I think the TinyG is not really made for analog measurements. There are no blocking capacitors at the VCC Pins. Especially the AVCC needs blocking capacitors, better with an inductance in series.
... contradicts ...
> Using the VCC as reference should be fine. It is regulated and filtered and precision is not what we should be looking for.
.. as the two are directly connected on a TinyG.
I agree, but hard to do on an existing PCB, right?
> Capacitor with 10nF at the pinhead connector between SS2 and GND
Didn't we always say you need a capacitor? It is even on the picture:
> Using the bandgap as reference has in my eyes the problem that the signal must be scaled down to max. 1V and it would be more prone to noise.
I would assume that this noise would be much smaller, especially
if you were to add the top divider R on the TinyG side
to SS2, and then lower divider R || 1µF ||
10nF to GND.
This could also keep the input voltage level at 3.3V (or 5V) for whatever sensor is on the other side.
As the input is then also protected by top divider R, the caps
could be lower value, I guess.
_Mark
I would assume that this noise would be much smaller, especially if you were to add the top divider R on the TinyG side to SS2, and then lower divider R || 1µF || 10nF to GND.
I'm not sure about this.I did some tests today with a 10nF cap at AVCC and SS2. No improvement. Actually the approx. 40 digits mean about +/- 10mV. I can accept this but I'm always looking for improvements. In the end the sensor itself will also not give a static signal and the the vacuum of the cheap pump is also not perfectly stable.Mark, what dynamic range do you measure at the SS2 pin? Does the voltage go down to nearly 0V and up to 2V?In my setup I measure approx. 2V without vacuum and 1V with maximum vacuum what means I'm currently wasting about half of the dynamic of the ADC. I have to recalculate the amplifier resistors and remove the offset voltage.BRKlaus
> Mark, what dynamic range do you measure at the SS2 pin? Does the voltage go down to nearly 0V and up to 2V?
I don't use the TinyG on my machine. I just have if on a testing rig, so I can test new OpenPnP developments against it. But it just drives one stepper...
My real machine has a Smoothie clone and the sensor is on a thermistor input.
> In my setup I measure approx. 2V without vacuum and 1V with maximum vacuum what means I'm currently wasting about half of the dynamic of the ADC. I have to recalculate the amplifier resistors and remove the offset voltage.
Frankly, I found the vacuum sensing only works for the larger
nozzle tips, as they have large losses when there is no part on
the nozzle tip, and those can be detected.
For the finest tip it doesn't really work. The pump pressure
fluctuates all over the place, and even the short time Difference
method will not work the next time you run the machine.
I believe these fluctuations are really in the vacuum pressure,
not in the measurements. The seal of the part against the nozzle
tip varies, the pump performance itself varies, the temperature
seems to matter, even the different quenching of the tube through
the drag chain might be a factor.
So I think you have enough dynamic range for what you can
reasonably expect to measure.
_Mark
--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/5bea39aa-0159-41ac-93cf-be66aa0ba732n%40googlegroups.com.