Open rolfmeurer opened 5 years ago
Hi Rolf,
I use the ATTINY85 without a crystal and the serial communications relies on all the ATTINY's clocks to be synchronised to within 1-2% or so. You can tune AVR chips by tweaking OSCCAL variable which I had done for previous projects. As such, I already had a board that I use to tune the frequencies. When the FreqCal.ino program is flashed to the ATTINY, I tune OSCCAL by watching a frequency generated on pin PB1. The rotary encoder changes the current OSCCAL and the encoder's button is pushed to set this value in the EEPROM. I read this value in all my subsequent ino scripts and set the frequency to that tuned OSCCAL in my void setup routine.
I made a little board that only has a BNC out to measure the frequency of a generated signal, a rotary encoder and a CONN_B2X05 connector which is used to plug in a USBASP programmer to flash the ATTINY chip with. Once I've set the OSCCAL freq, I reflash the chip with the smartencoder firmware and remove the chip from the board. I do this for all the chips in my project by first tuning the frequency on all the chips to be used, then flashing them all with the smartencoder firmware. Takes around a minute per chip. The programmer shares some pins with the rotary encoder on the board via the CONN_B2X05 connector. As long as I don't touch the encoder while the chip is being flashed, there are no problems doing this.
I have separate board layout for the smart encoder part that uses the pins set up in the ATTINY85RotEncCode.ino sketch. I should have uploaded this schematic and board layout too.
Does the above make sense?
I will remove the need for tuning the onboard oscillator frequency in future by using a chip with more pins available and hook up a crystal to provide a much more accurate clock.
Do you mind me asking what you have in mind with this code? I uploaded it here in this poorly documented state since I was explaining how to use it to colleagues and friends in person. I will tidy up the documentation and upload clearer code in the near future but probably not this week. If you would like a basic board layout for the smart encoder, I'll try to upload my Kicad projects here within a day or two.
Regards, Matthew
Hi Matthew,
Thank you for the kindly answer.
I have an encoder layout with an LED ring works perfectly, but needs an arduino MINI PRO each.
I hope I can merge your ATTiny smart encoder with my LED RING (using a 74HC595 4x4 LED matrix) to get it all on a tiny PCB just as an universal Encoder module.
It shouldn't become a little tiny module just 30x30mm as it is now and on the buttom lay is still enough place to ge an ATTiny placed your FreqCalc schematic fits onto the PCB
Can you please send me a link to the schematic of the main smart encoder?
I'm fine with ATTINY a bigger chip would exceed the PCB layeout size
I'm working for KRAFTWERK and I'm always looking for new devices to give our equipment more haptic.
Rregards,
Rolf
Von: MatthewAHarvey [mailto:notifications@github.com] Gesendet: Montag, 10. Dezember 2018 17:21 An: MatthewAHarvey/SmartEncoder Cc: Rolf Meurer; Author Betreff: Re: [MatthewAHarvey/SmartEncoder] SmartEncoder Pinout (#1)
Hi Rolf,
I use the ATTINY85 without a crystal and the serial communications relies on all the ATTINY's clocks to be synchronised to within 1-2% or so. You can tune AVR chips by tweaking OSCCAL variable which I had done for previous projects. As such, I already had a board that I use to tune the frequencies. When the FreqCal.ino program is flashed to the ATTINY, I tune OSCCAL by watching a frequency generated on pin PB1. The rotary encoder changes the current OSCCAL and the encoder's button is pushed to set this value in the EEPROM. I read this value in all my subsequent ino scripts and set the frequency to that tuned OSCCAL in my void setup routine.
I made a little board that only has a BNC out to measure the frequency of a generated signal, a rotary encoder and a CONN_B2X05 connector which is used to plug in a USBASP programmer to flash the ATTINY chip with. Once I've set the OSCCAL freq, I reflash the chip with the smartencoder firmware and remove the chip from the board. I do this for all the chips in my project by first tuning the frequency on all the chips to be used, then flashing them all with the smartencoder firmware. Takes around a minute per chip. The programmer shares some pins with the rotary encoder on the board via the CONN_B2X05 connector. As long as I don't touch the encoder while the chip is being flashed, there are no problems doing this.
I have separate board layout for the smart encoder part that uses the pins set up in the ATTINY85RotEncCode.ino sketch. I should have uploaded this schematic and board layout too.
Does the above make sense?
I will remove the need for tuning the onboard oscillator frequency in future by using a chip with more pins available and hook up a crystal to provide a much more accurate clock.
Do you mind me asking what you have in mind with this code? I uploaded it here in this poorly documented state since I was explaining how to use it to colleagues and friends in person. I will tidy up the documentation and upload clearer code in the near future but probably not this week. If you would like a basic board layout for the smart encoder, I'll try to upload my Kicad projects here within a day or two.
Regards, Matthew
- You are receiving this because you authored the thread. Reply to this email directly, view https://github.com/MatthewAHarvey/SmartEncoder/issues/1#issuecomment-445875 601 it on GitHub, or mute https://github.com/notifications/unsubscribe-auth/AQllwpYz-xzs8KZOzP11C5a9T zwYMLP9ks5u3ondgaJpZM4ZKUy1 the thread. https://github.com/notifications/beacon/AQllwiyel6Icx6k2tTs2NN2qpgP0B_mgks5 u3ondgaJpZM4ZKUy1.gif
Hi Rolf,
Your use case is exactly what I had in mind for this project so this is exciting. I am also interested in feedback and physical controls and have been disappointed with modern tactileless touchscreens appearing everywhere. Also, often modern controls just feel slow and clunky. The volume control knob in my car is very slow and the aircon temperature knob's encoder would miss events and not respond if not turned extremely slowly. That was very annoying in the summer heat when getting in to the car. I have thought about making a synthesizer but I have zero musical ability. KRAFTWERK is great too by the way.
I have just uploaded some Kicad projects to the PCBs subfolder for you. The ATTINYFreqSet board is my crude way to tune the oscillator frequencies and flash the chips before installing them in their final boards. The RotaryEncoderAttiny85_TEST_PCB one is my original test board where I daisy-chained 5 smart encoders together. Both of these boards use DIP packaged ATTINYs for ease of use while I developed the principle. The final board, RotaryEncoderAttiny85_SOIC, should work and on this one the ATTINY is a SOIC package and would fit beneath the encoder. I don't have a programmer board, or better still a header for programming the chip in place on this. The SOIC chips have been sat on my shelf for six months waiting for me...
At the moment, I used three for a LED strip controller toy that I built for my son and about 60 or so in a physics research lab where we build our own computer controlled power supplies etc. There are 3 power supplies with about 20 smart encoders each. This frees up a controlling arduino to respond to the power requirements and control requests whilst continuously updating an LCD panel at a much faster rate than an older design which had to poll many encoders. I can tell you that these power supplies have been in daily use for 6 months or so without a single problem so this serial daisy chain method seems to work very well. They don't look pretty because we didn't finish them before putting them in to use. One day...
Power supply control panels:
My son's toy during development (it's still not finished):
Very early test board and the one I used in my son's toy:
I have been discussing expanding on this smart encoder idea with some friends including status LEDs as you are doing. When a microcontroller is now so cheap, why not use many to make the design process easier and offload processing from the main controller?
The current firmware allows for the following events: Clockwise rate 1 Clockwise rate 2 Clockwise rate 3 Anticlockwise rate 1 Anticlockwise rate 2 Anticlockwise rate 3 Button down Button up Button hold Button doubleclick
The rates can be tuned to feel very good. For example, it's very easy to set our power supplies with milliVolt accuracy in 0.001V steps when rotating an encoder slowly, Move it in 0.1 Volt steps at a normal/natural rotation speed and very rapidly in say 10V steps for rapidly changing the voltage by a few hundred volts. It feels intuitive and makes our instruments very easy to tune. More than three rates could be used but I haven't coded them yet as we haven't felt the need. It would provide even more nuanced control though.
With regards to your LED ring, I don't think there are enough spare pins on an ATTINY85 to do this? As you can hopefully see from picture three though, there would be plenty of room to fit an MCU with more pins in SOIC package or possibly even DIP if it was mounted on the opposite side of the board and still fit your 74HC595 plus LEDs. For reference, the knobs on our power supplies are 36 mm apart and they are 40mm apart on my original test board. That board includes space for in and out connectors though so easily could be shrunk down.
I'll be updating the code to make it more readable soon. Especially the serial handling code on the ATTINY85RotEncCode.ino sketch.
Regards, Matthew
Hi Matthew,
Great project you Power Supply.
Nice and good readable Analyzer display design.
About the pins, the LED Ring is driven by a 74HC595.
So the Encoder and the LED ring could communicate serially with the tiny
I think it could work anyhow by puzzle & pray
And one PCB should not exceed 30mm x 30mm to align them know by know horizontally as well as vertically.
On my PCB top layer is still enough space to add a Tiny85 SOT and perhaps 4 resistors or capacitors .
Chips with more pin's I'm not sure it would match on the PCB, but if so, then it's a great benefit.
Here comes a snap from a 9x9 encoder & LED proto PCB
Regards Rolf
Von: MatthewAHarvey [mailto:notifications@github.com] Gesendet: Donnerstag, 13. Dezember 2018 15:54 An: MatthewAHarvey/SmartEncoder Cc: Rolf Meurer; Author Betreff: Re: [MatthewAHarvey/SmartEncoder] SmartEncoder Pinout (#1)
Hi Rolf,
Your use case is exactly what I had in mind for this project so this is exciting. I am also interested in feedback and physical controls and have been disappointed with modern tactileless touchscreens appearing everywhere. Also, often modern controls just feel slow and clunky. The volume control knob in my car is very slow and the aircon temperature knob's encoder would miss events and not respond if not turned extremely slowly. That was very annoying in the summer heat when getting in to the car. I have thought about making a synthesizer but I have zero musical ability. KRAFTWERK is great too by the way.
I have just uploaded some Kicad projects to the PCBs subfolder for you. The ATTINYFreqSet board is my crude way to tune the oscillator frequencies and flash the chips before installing them in their final boards. The RotaryEncoderAttiny85_TEST_PCB one is my original test board where I daisy-chained 5 smart encoders together. Both of these boards use DIP packaged ATTINYs for ease of use while I developed the principle. The final board, RotaryEncoderAttiny85_SOIC, should work and on this one the ATTINY is a SOIC package and would fit beneath the encoder. I don't have a programmer board, or better still a header for programming the chip in place on this. The SOIC chips have been sat on my shelf for six months waiting for me...
At the moment, I used three for a LED strip controller toy that I built for my son and about 60 or so in a physics research lab where we build our own computer controlled power supplies etc. There are 3 power supplies with about 20 smart encoders each. This frees up a controlling arduino to respond to the power requirements and control requests whilst continuously updating an LCD panel at a much faster rate than an older design which had to poll many encoders. I can tell you that these power supplies have been in daily use for 6 months or so without a single problem so this serial daisy chain method seems to work very well. They don't look pretty because we didn't finish them before putting them in to use. One day...
Power supply control panels:
My son's toy during development (it's still not finished):
Very early test board and the one I used in my son's toy:
I have been discussing expanding on this smart encoder idea with some friends including status LEDs as you are doing. When a microcontroller is now so cheap, why not use many to make the design process easier and offload processing from the main controller?
The current firmware allows for the following events: Clockwise rate 1 Clockwise rate 2 Clockwise rate 3 Anticlockwise rate 1 Anticlockwise rate 2 Anticlockwise rate 3 Button down Button up Button hold Button doubleclick
The rates can be tuned to feel very good. For example, it's very easy to set our power supplies with milliVolt accuracy in 0.001V steps when rotating an encoder slowly, Move it in 0.1 Volt steps at a normal/natural rotation speed and very rapidly in say 10V steps for rapidly changing the voltage by a few hundred volts. It feels intuitive and makes our instruments very easy to tune. More than three rates could be used but I haven't coded them yet as we haven't felt the need. It would provide even more nuanced control though.
With regards to your LED ring, I don't think there are enough spare pins on an ATTINY85 to do this? As you can hopefully see from picture three though, there would be plenty of room to fit an MCU with more pins in SOIC package or possibly even DIP if it was mounted on the opposite side of the board and still fit your 74HC595 plus LEDs. For reference, the knobs on our power supplies are 36 mm apart and they are 40mm apart on my original test board. That board includes space for in and out connectors though so easily could be shrunk down.
I'll be updating the code to make it more readable soon. Especially the serial handling code on the ATTINY85RotEncCode.ino sketch.
Regards, Matthew
- You are receiving this because you authored the thread. Reply to this email directly, view https://github.com/MatthewAHarvey/SmartEncoder/issues/1#issuecomment-446996 360 it on GitHub, or mute https://github.com/notifications/unsubscribe-auth/AQllwtBUgvIkVVj9L6YN_zX34 0n6XEd7ks5u4moZgaJpZM4ZKUy1 the thread. https://github.com/notifications/beacon/AQllwgEHowhWPghYLls7aU5xR2PGJD45ks5 u4moZgaJpZM4ZKUy1.gif
Hi Rolf,
Thanks for the comments about the analyser power supply, however I can not take credit for that design. My friend and colleague Ahmad designed and built those power supplies including all the display stuff. I just provided the smart encoder bit with a lot of input and help from Ahmad. He is visible in the background photo on his website, which was taken in our research lab.
Can you try attaching your picture again please? Nothing is showing. Perhaps I can help you with your design? Also, have you seen this palettegear stuff? Very slick and very expensive but they seem to have thought along the same/similar lines to us.
Matthew
Hi Matthew,
it seems there have lots of people the same idea:
https://www.geeky-gadgets.com/mine-modular-dj-controller-26-01-2017/
Von: MatthewAHarvey [mailto:notifications@github.com] Gesendet: Donnerstag, 13. Dezember 2018 20:50 An: MatthewAHarvey/SmartEncoder Cc: Rolf Meurer; Author Betreff: Re: [MatthewAHarvey/SmartEncoder] SmartEncoder Pinout (#1)
Hi Rolf,
Thanks for the comments about the analyser power supply, however I can not take credit for that design. My friend and colleague Ahmad designed and built those power supplies including all the display stuff. I just provided the smart encoder bit with a lot of input and help from Ahmad. He is visible in the background photo on his website https://ahmadsakaamini.com/about/ , which was taken in our research lab.
Can you try attaching your picture again please? Nothing is showing. Perhaps I can help you with your design? Also, have you seen this palettegear https://palettegear.com/ stuff? Very slick and very expensive but they seem to have thought along the same/similar lines to us.
Matthew
- You are receiving this because you authored the thread. Reply to this email directly, view https://github.com/MatthewAHarvey/SmartEncoder/issues/1#issuecomment-447097 638 it on GitHub, or mute https://github.com/notifications/unsubscribe-auth/AQllwkBFgOG3D5rzxHrfXa7Q9 SsBbr2Jks5u4q9agaJpZM4ZKUy1 the thread. https://github.com/notifications/beacon/AQllwh1BNKs7M5LM_IYb766uVFwJZlZfks5 u4q9agaJpZM4ZKUy1.gif
I'm a bit confused about diferent encoder pinout in FreqCal.ino and ATTINY85RotEncCode.ino
is there a diferent hardware pinout for FreqCal and for the Main program?
I am up to design an encoder PCB with LEDs, but it's not clear if the FreqCal schematic works as it is for the main program too. Neither clear is the need of the Pushbutton wiring to the CONN_ß2X05 P2 connector. Is this only for the FreqCalc or for further usage too?
FreqCal.ino: const int encPinA = 3; //pin 2 const int encPinB = 4; //pin 3 const int encPinC = 2; //pin 7
ATTINY85RotEncCode.ino: const int encPinA = 2; //pin 7, PCINT2 const int encPinB = 1; //pin 6, PCINT1 const int encPinC = 3; //pin 2, PCINT3