Closed bwack closed 5 years ago
In your latest YouTube video you mentioned menu navigation. A single button is not enough for that. Can we have a pushable rotary encoder instead of the button? Are there any pins left unused on AtTiny?
Actually we could use a single button (long press to enter selection mode, single press in selection mode to change option and long press again to select it) but that would be awkward, especially for selecting cutoff voltage.
It will be only one button at this time. Hardware changes at this point is hard. Yes something like that (long and short presses). I was thinking of having pages flipped by short presses, then a long press on a page will enter settings for that page. and then short presses that selects preset values like OFF 1.5A 2A 3A etc.
pages and settings:
Just suggestions. There are so few options anyway I don't think we need much input from the user. btw the button is shared with the 9vac adc voltage input.
cut-off voltage is not possible to set. Well it can be working if we increase the saver-boards threshold to say 6V, and then you can have a software controlled trip point. It depends on how accurate the ina219 is.
https://learn.adafruit.com/adafruit-ina219-current-sensor-breakout/overview https://learn.adafruit.com/adafruit-ina219-current-sensor-breakout/downloads In the datasheet it says Bus Voltage Measurement Error 0.2% typical and +-1% over temperature.
I am very happy that you like to help on this. Very much appreciated !
No problem. Please send me the boards so I can start. Let me know (on Facebook or in mail) if there are any additional components I'll need. I'm going to order some unrelated stuff from Mouser in the next couple of days so I could order these components as well.
Sounds great. Can you start with a breadboard setup ? I can send you display, ina219 breakout board and an attiny85 soldered on dip8 adapter. Do you have a usbasp or similar ? I need to spend time debugging the addon board first.
I have only TL866A. I guess I could do it on a breadboard but I'd rather do it on a proper board, even if it means waiting longer.
OK.
I noticed yesterday that I could not progam the attiny with ICSP using the TL866A/minipro. The setting for using ICSP in the minipro software application was disabled/grayed out. Was able to do it with atmega328p, but not attiny85.
There is PGM-11801 but it's out of stock on Mouser. https://learn.sparkfun.com/tutorials/tiny-avr-programmer-hookup-guide
Check schematics in Step 1 here. Would that help? https://www.instructables.com/id/Arduino-ISP-to-ATTiny85/
Never mind, that doesn't look like ICSP.
U2 seems to be interfering with ICSP. See linked thread for details. OLED should be probably disconnected as well while using ICSP. https://www.eevblog.com/forum/projects/issue-programming-attiny-using-icsp/
That issue is different. The guy on the eevblog forum had an output always forcing the sck line, while we have a I2C isolator which is both high impedance and driving. The line should be high impedance normally. Lets see if it works.
If you like can you see if you can add the TinyWireW library to the project? I't is a C++ wrapper for another TWI library (coded in C) I think comes with the avr-gcc installation. Or we could use that library directly. Or go C++..
Was logged into my work account. Take a look at dtulans nunchuk project, There is a compact I2C master library. Looks handy. https://github.com/djtulan/nunchuk64/tree/master/src
Another USI-I2C code and interesting read about I2C https://www.instructables.com/id/ATTiny-USI-I2C-The-detailed-in-depth-and-infor/ https://github.com/CalcProgrammer1/Stepper-Motor-Controller/tree/master/UnipolarStepperDriver
Thanks. This is a great I2C guide. Which slave I2C addresses are we using and which values can I expect from them?
Regarding libraries and mixing C with C++, I'm not a fan of either. I2C seems to be simple enough, it's just another way of bitbanging. I'm sure I can write my own code for that. Same for driving the OLED, I've done it in VHDL so doing it again in C should be straightforward. Using libraries is ok for complex stuff.
if you use the usi hardware module, I think you only need to bit bang the serial clock. a bit weird how that works and that it is not fully hardware controlled.
Programming the ATTiny85
We will use the Ardino IDE or avr-gcc toolchain. For OLED display and ATTiny we will base our code on this project:
Number 2. seems the most interesting.
The MCU will be connecting with these devices over I2C
The 9VAC is fed in on a ADC pin, and is shared with the button. If the ADC reads around 0, then the button is pressed.