Couple of things - if you use INPUT_PULLUP instead of INPUT in your pinMode lines, you don't need to set HIGH in another place. And if you trigger interrupts on both inputs, you can get double the resolution - although takes a bit more coding to do this. I use an encoder library to do this for me. Lastly, you could use a board with a faster cpu clock to overcome the speed problem, the Wemos D1 mini is very cheap, and you can program them using the Arduino IDE. Most of your code would be identical.
@CuriousScientist4 жыл бұрын
These are great inputs, thank you! I have never heard about this board, I will look it up. I guess you know about the 'blue pill' (STM32F103) boards. They are running at 72 MHz, so they are also much faster than an Arduino, and they are a bit cheaper than the Wemos. I will test these boards later, but I have other tasks to finish first.
@fredgenius4 жыл бұрын
@@CuriousScientist You are welcome, and thanks for a good video. The Wemos D1 Mini is based on the ESP8266 chip, has 80MHz clock I think. An alternative would be a board based on the ESP32, also fairly low priced, I think they run at 160MHz, and have dual cores.
@7LegSpiders8 ай бұрын
I just ordered an eps32 to read two glass scales. I'll let you know soon how that works out.
@fredgenius8 ай бұрын
@@7LegSpiders I hope you have success! There are many ESP32 boards on the market now, for example the ESP32-C3 boards, which are very low priced, and very small physical size. The only downside to an ESP32 board is that their GPIO pins are 3.3V, not 5V as with the 'AVR' boards (Uno and Nano). This is easily fixed though, and might not need fixing at all if the read head can work at 3.3V. I don't have a scale to hand to test this right now, but I think it is quite likely. Worst case, a level shifting board would cost very little.
@arva1kes Жыл бұрын
This is really old, but since I'm starting to work on this too then I just put it in here: - serial printing is slow and will block you whole code. So if you don't need it( usin lcd only) then disable it. If you need it use high speeds (115200 or creater) so arduino won't wait on the code to be sent on this slow link. It will make whole code faster. - it's not necessary to print out every change on lcd since you can't see it anyways. printing to lcd take cpu time. it should be printed with fixed intervals in addition to if change is detected. AFAIK lcd.clear() is slow. It would be better to pad the number to full 5 or 6 digits all the time so that you write 00256 instead of just 256 if you don't fill whole area (or " 256" if you prefer). This also make reprinting of text unnecessary making whole lcd code atleast 2-3x faster. - It seems you are missing pulldown resistor on input and this makes signal to drop really slowly making miss steps on higher speeds. - This digital oscilloscope is not too much more powerful than arduino - it will start missing signal very soon if speeds go high.
@CuriousScientist Жыл бұрын
Hi! I know all these things you mentioned, especially 3 years after publishing this video I learned a lot more. The code is built for demonstration, so I needed the serial printing because otherwise, I could not show that the data comes through the serial port. I both agree and disagree with your second comment. You might want to print every change because if you use this in a milling machine, you may want to see those few microns instantaneously. That's why I update the code when there is a change and not when a certain time interval is elapsed. The lcd.clear is slow, yes, I could have used better practice. Nowadays, I print the permanent characters on the display in the setup() part of the code and then when I update the display, I print whitespaces over the old values and print the new ones. I believe an oscilloscope is much faster than an Arduino when it comes to processing signals.
@Hossein_Ash2 жыл бұрын
Thank you, very helpful.
@CuriousScientist2 жыл бұрын
You are welcome!
@adamspontarelli64184 жыл бұрын
thank you!
@CuriousScientist4 жыл бұрын
Hi Adam! I am glad that this video was useful for you! Please check back frequently, because I will release a lot of interesting videos in the coming weeks.
@3goldfinger10 ай бұрын
If you reverse pi 2 and 4, will anything happen, I can't seems to find the right info on it.
@CuriousScientist10 ай бұрын
As long as you mix data pins, nothing wrong can happen. You just don't get any results. Be sure not to mix power pins.
@3goldfinger10 ай бұрын
Thanks a lot, that was quick.
@CuriousScientist10 ай бұрын
You're welcome! The notifications are enabled on my phone. 😉
@luizcarlosarrudajunior34024 жыл бұрын
Arduino is no fast enought for fast movements
@CuriousScientist4 жыл бұрын
I am using it for speeds such as 10 mm/min. It is perfect for that. For large speeds you want a dedicated hardware or an absolute encoder. :)