Atmega 328p yet another hardware post ;)

Intel or AMD? nVidia or ATI? Lenovo or ASUS? All things computing hardware go here

Atmega 328p yet another hardware post ;)

Post by pretentious on Wed Aug 16, 2017 4:34 am
([msg=94106]see Atmega 328p yet another hardware post ;)[/msg])

So I've been playing a lot with Raspberry pi's and arduino's lately and they're better than orgasms, but I've hit a road bump.
I've run out of usb ports and power points :lol:

The strength of these devices is that they're cheap and don't draw much energy, but that's somewhat irrelevant when you need a power point and maybe a $15 double adapter or usb adapter to get it set up.

I need to go deeper.......

The heart(or brains) of the arduino uno is an atmega chip. All the things that you plug your jumper leads into are effectively connected to one of the chips pins and you've got an external crystal and usb interface and a regulator and stuff. Basically
https://www.arduino.cc/en/Main/Standalone you can source all the parts yourself and build one. What an age we live in my friends 8-)

I'm sorta trying to build up to my point but I'm already getting impatient after 3 paragraphs so I'll cut to the chase. I want the functionality of an arduino in a portable package and to last aaaages (I hate batteries, I'm all about the long term, set it up and leave it)

The problem with arduinos is all these extra components sap energy from it during normal opperation. If you remove these peripherals, you can get your portable arduino ;)

if you read through this http://www.atmel.com/Images/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdf you'll find that the atmega 328 has a minimim working voltage of 1.8v
That can be achieved with a battery or 2 in series.
It also has power saving features and allow it to draw, like micro amps while sleeping.

So I got some atmega chips from ebay, with the crystals and capacitors and tried to set them up like this
http://www.instructables.com/id/Standalone-Arduino-ATMega-chip-on-breadboard/

The manufacturer that I bought the chips from already pre burnt the bootloader to the chip, and that's lucky because I sucked at getting that to work, as instructed here https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard

I was able to hook up my tx, rx lines to the chip while on a breadboard and got a simple blinking light POC working!
http://stumay.net/wp-content/uploads/2017/08/img_1997.jpg

sketch code:
Code: Select all
#include "LowPower.h"
// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  LowPower.idle(SLEEP_8S, ADC_OFF, TIMER2_OFF, TIMER1_OFF, TIMER0_OFF,
SPI_OFF, USART0_OFF, TWI_OFF);

  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
}

I used rocketscreams low power library https://github.com/rocketscream/Low-Power but I forget the exact link I downloaded to get the zip. The git repo didn't help lol

Anyway. I wanted to do this write up after a week of my board blinking. I'm terrible at maths but from the rough calculations I've done, If the low power stuff didn't work, the batteries should have died by now. 2500 mah, led draws maybe 20ma atmega draws maybe 15ma without power savings etc.

I haven't actually checked how much current the chip pulls during sleep because I'm incompetent and don't know how to use a multi-meter lol

With this POC, I should hypothetically be able to set up devices that are wireless enabled and sensors and other outputs and can last months on som cheap aa batteries. FTW
Goatboy wrote:Oh, that's simple. All you need to do is dedicate many years of your life to studying security.

IF you feel like exchanging ASCII arrays, let me know ;)
Can you say brainwashing It's a non stop disco
User avatar
pretentious
Addict
Addict
 
Posts: 1177
Joined: Wed Mar 03, 2010 12:48 am
Blog: View Blog (0)


Re: Atmega 328p yet another hardware post ;)

Post by cyberdrain on Tue Aug 22, 2017 4:54 pm
([msg=94146]see Re: Atmega 328p yet another hardware post ;)[/msg])

It's probably much easier to add a solar panel to the outside somewhere or draw energy from movement or heat differences, assuming you do take it outside. I'm worried anything wireless could draw a lot of power, so you might want to be able to enable that through other means only when required. Apart from that, this is pretty cool stuff. Haven't played around with it as much, but you seem to be well under way. :)
Free your mind / Think clearly
User avatar
cyberdrain
Expert
Expert
 
Posts: 2160
Joined: Sun Nov 27, 2011 1:58 pm
Blog: View Blog (0)


Re: Atmega 328p yet another hardware post ;)

Post by pretentious on Thu Aug 24, 2017 4:18 am
([msg=94158]see Re: Atmega 328p yet another hardware post ;)[/msg])

cyberdrain wrote:It's probably much easier to add a solar panel to the outside somewhere or draw energy from movement or heat differences, assuming you do take it outside.

I'd have to regulate the voltage though, from what I think I understand. chemical batteries don't produce variety and spikes in voltage so it's pretty safe. It would be fantastic to just have it running for pretty much ever off solar power 8-)
cyberdrain wrote:I'm worried anything wireless could draw a lot of power, so you might want to be able to enable that through other means only when required.

Tru dat. Apparently the esp8266 can draw an amp, which would not go down well with most batteries, so there's a barrier of entry, unless I learn to push bluetooth or zigbee over mqtt or something. Apparently you can pull high ampere's from lithium batteries so I'm looking into that, and also there are pretty decent power saving modes on the esp8266 wifi chip. I'm still dipping my toes in though. The learning curve isn't super shallow now that I'm trying to take away half of the arduino's peripherals and eliminating the costly overhead that provides margin for error. My light occasionally doesn't start up and I have absolutely no idea why lol
Goatboy wrote:Oh, that's simple. All you need to do is dedicate many years of your life to studying security.

IF you feel like exchanging ASCII arrays, let me know ;)
Can you say brainwashing It's a non stop disco
User avatar
pretentious
Addict
Addict
 
Posts: 1177
Joined: Wed Mar 03, 2010 12:48 am
Blog: View Blog (0)



Return to Hardware

Who is online

Users browsing this forum: No registered users and 0 guests