Showing posts with label Arduino. Show all posts
Showing posts with label Arduino. Show all posts

Tuesday, January 1, 2019

More Battery Monitor

It was still too hard to tell whether the new batteries were coming up to full charge, so while I waited, I added to the monitor. I already have a current shunt for the old "Heart/Cruising Designs" monitor and now the Xantrex LinkLite, so all I had to do was hook the ADS1115 differential input channels to it.

I added the current monitor with amp hour calculation and a status web page to the Batt_volt_mon. I re-factored the code using the tab capability of the Arduino IDE rev 1.8.8.

I also copied from a friend the idea to make each tab's code optionally included at compile time with #ifdef's. This makes it easier to debug.


  #define DO_ADS
  #ifdef DO_ADS
     #include "ads.h"
  #endif //DO_ADS
     ...
  #ifdef DO_ADS
     setup_ads();
  #endif // DO_ADS
     ...
  #ifdef DO_ADS
     if ( (last_ads + ads_time) < millis() ){
       last_ads = millis();
       loop_ads();
     }
  #endif //DO_ADS
     ...

 
And I uploaded the new code to my github.

Top of the board with the modules out to see the wires
The bottom of the board

And then I documented the connections in Fritzing.
The Fritzing layout

Tuesday, January 6, 2015

Make an ATTiny85 Progrsmmer and Development Board

I got a few of these small cheap chips from Atmel in the AVR family, like the arduinos. Not sure why I need cheap, with the atmega328p around $4, these tiny85s were about $3 when the STM32 ARM family of NUCLEO boards are only $12. That's over 100 times faster and already a development board. It is cheap enough to put in a project or two and just leave there.

But anyway, I have a few and a couple target projects that could use a small cheap controller. Like a fridge fan that turns a small fan on to control the temperature in a small compartment. Or an automatic shutoff for the cooling exhaust fan inside the generator room when the temp drops enough.

Everybody else is making clones, so here's a go. No, really I just need a way to program a few. My programming seems to be the kind that is, change a line of code, download it, test, repeat,...for days... so I need to be able to re-program the devices multiple times without hassle.

Poking around the web I find numerous posts about programming on a breadboard with a bunch of jumper wires either from a programmer or via an arduino. Also I found a few custom boards and even Sparkfun.com has the Tiny AVR Programmer for the ATTinyx5s.  But ordering things here to the Philippines is traumatic at best.

Since I already have the Adafruit USBtinyISP AVR Programmer Kit (and several others) I don't need a programmer, I need an adapter for it. I got most of my final ideas from Arvydas and his programmer.


I decided as long as I was soldering somethin up, it might as well have a few comnnectors so I can use a prototype board to test a design easily

Here is the strip-board diagram in Fritzing.


The bottom of my strip-boards are always ugly.
Starting from upper left is the 6-pin AVR programming header. I chose it because it has +5 and GND as well as the programming signals and can power the board. Next a red LED to show power to the board. Upper right is an LED tied to pin 4 for the default blink 'hello world' program. But with so few pins available, a jumper to disconnect the LED for pin 4 in case the application wants that pin. Below it is a reset switch.

Next across the bottom are headers, arduino like, bringing out each pin as well as an extra +5 and GND. There never seem to be enough. I also thought it could support a mini shield too.

AVR AT Tiny85  programmer and development board.