Arduboy Sculpture [RIP]


(Kea Oliver) #41

Use a smaller battery? It doesnt need to run as long so who cares if the battery life is reduced. Unless you want this to be an everyday usable thing.


(Kevin) #42

I’m going to be using a LIR2016 which has about 10 mAh which lets it run for about 30-45 minutes.


#43

Will that battery be powerful enough for games with a lot of lit pixels (like Arduventure) ? I’ve read that it’s common for batteries max current to be limited to twice the batteries capacity.

Sticking a battery under the display is a good idea.


(Kevin) #44

Should do just fine, I tested these with the original prototype. These coin cell packages have decent current carrying capacity.

All white game probably last about 15 minutes lol.


(Scott R) #45

You could always slow things down a little to extend battery and cut out a few components. My latest Arduboy distraction is using a low power Pro Mini clone 3.3v 8mhz ATmega328P and internal oscillator.


(Kevin) #46

Yah but I don’t really feel like refactoring the code. The original was also a 328p which is also nice because the package is smaller too.


(Kevin) #47

Ok so obviously this isn’t immediately compatible with the capacitive touch library:

So I guess the next step is to take this and instead of it waking on interrupt, it needs to wake up after a certain delay and test the capacitive buttons, then go back to sleep?


(Scott R) #48

What’s the smallest peltier they do you might be able to generate enough by rubbing or touching it to trigger an interrupt.

Or if you had a case you could use solar like an old school calculator you could pull the panel out of one of those cheap little waving cat/ dancing flower things.


(Kevin) #49

it will be fine on its rechargeable coin cell. Just need it to sleep when im not using it.


#50

You can use the watchdog timer to wake up from power down every 0.5 seconds and read your capacitive buttons.


(Kevin) #51

Yep just need to remember how to use the watchdog timer!


(Kevin) #52

I got the watchdog timer to wake the Arduboy, but it always resets it, I can’t seem to get the timer to just simply wake the device, it always resets.

void autoPowerDown(uint8_t timeout)
{
#ifndef ARDUBOY_CORE
  uint16_t time;
  asm volatile(
    "    in    __tmp_reg__, __SREG__    \n\t" //uint8_t oldSREG = SREG;
    "    cli                            \n\t" //cli()
    "    lds   %A[time], %[millis1]     \n\t" //time = (uint16_t)(millis >>8)
    "    lds   %B[time], %[millis2]     \n\t" 
    "    out   __SREG__, __tmp_reg__    \n\t" //SREG = oldSREG
    "    sub   %A[time], %A[APD_time]   \n\t" //time -= APD_time
    "    sbc   %B[time], %B[APD_time]   \n\t" 
    "1:                                 \n\t" 
    : [time]     "=&r" (time)
    : [millis1]  ""    ((uint8_t*)(&timer0_millis)+1),
      [millis2]  ""    ((uint8_t*)(&timer0_millis)+2),
      [APD_time] "r"   (APD_time)
  );  
  if (time >= timeout * 16)
#else
 if (buttonsIdleTime() >= timeout)
#endif    
  {
  #ifndef ARDUBOY_NO_USB
    UDIEN = 0;            //disable USB interrupts left enabled after upload
    USBCON = _BV(FRZCLK); //disable VBUS transition interrupt, freeze USB clock for power savings
    UDCON  = 1 << DETACH; //disconnect from USB bus
  #endif
  
  
    /* Clear the reset flag. */
  MCUSR &= ~(1<<WDRF);
  
  /* In order to change WDE or the prescaler, we need to
   * set WDCE (This will allow updates for 4 clock cycles).
   */
  WDTCSR |= (1<<WDCE) | (1<<WDE);

  /* set new watchdog timeout prescaler value */
  WDTCSR = 1<<WDP0 | 1<<WDP3; /* 8.0 seconds */
  
  /* Enable the WD interrupt (note no reset). */
  WDTCSR |= _BV(WDIE);
  
    all_LEDs_off();
    Arduboy2Core::displayOff();
    //INT6_enable();               //enable A button interrupt


    activatePowerDown();
    //INT6_disable();
  #ifndef ARDUBOY_NO_USB
    init();                      //restore USB support
    USBDevice.attach(); 
  #endif
    Arduboy2Core::displayOn();
#ifndef ARDUBOY_CORE    
    autoPowerDownReset();
#endif    
  }
#ifndef ARDUBOY_CORE    
  if (Arduboy2Core::buttonsState()) autoPowerDownReset(); //reset power down time on any button press
#endif  
}

Any ideas?


(Kevin) #53

Not really sure why but this ended up working:

  MCUSR = 0;                          // reset various flags
  WDTCSR |= 0b00011000;               // see docs, set WDCE, WDE
  WDTCSR =  0b01000000 | 0b100000;    // set WDIE, and appropriate delay
  wdt_reset();

So now all I gotta do is check the buttons and put it back to sleep if nothing pressed :smiley:


(Kevin) #54

Sometimes I get stuck on the most simple things, how do I call an arduboy function from within another library?

	if (Arduboy2::pressed(A_BUTTON | B_BUTTON | UP_BUTTON | DOWN_BUTTON | RIGHT_BUTTON | LEFT_BUTTON)){
		// button pressed so go back to the game
	}else{
		// nothing pressed go back to sleep for 8 more seconds
	MCUSR = 0;                          // reset various flags
	WDTCSR |= 0b00011000;               // see docs, set WDCE, WDE
	WDTCSR =  0b01000000 | 0b100001;    // set WDIE, and appropriate delay
	wdt_reset();
  
    activatePowerDown();
		
	}

Which throws this error:

sketch\src\autopowerdown.cpp:89:102: error: cannot call member function ‘bool Arduboy2Base::pressed(uint8_t)’ without object


(Kea Oliver) #55

Im a newb but dont you have to call an object of that class first so like
Arduboy2 arduboy;

then change the first bit to

if (arduboy::pressed(A_BUTTON | B_BUTTON | UP_BUTTON | DOWN_BUTTON | RIGHT_BUTTON | LEFT_BUTTON)){

?


(Kevin) #56

That’s how you would initialize it within the sketch, but it is outside of the scope of the library.

FIXED, buttonsState() works for me, and it’s exposed.

	while(!Arduboy2Core::buttonsState()){

	MCUSR = 0;                          // reset various flags
	WDTCSR |= 0b00011000;               // see docs, set WDCE, WDE
	WDTCSR =  0b01000000 | 0b100001;    // set WDIE, and appropriate delay
	wdt_reset();
  
    activatePowerDown();
	
	}

Alright, software is done, now it’s time to solder up some magnet wire! The challenge will be soldering the second connection without the heat conducting through to the other side. You can only quickly tap the soldering iron to it.

This is the plan (not to scale)


(Scott R) #57

Have you tried wire glue?


(Kevin) #58

I have some conductive carbon ink but no glue, I don’t suspect it would work at all at this fine pitch as I’m heavily relying on the surface tension (or whatever the property is) of the solder sucking the wire or component to the pad.

I’m going to use the conductive ink to make the battery connection.


(Kea Oliver) #59

Use the smallest tip you have and some flux, flux it, add a little solder to the tip and press. You should be able to solder fine with just a teeny tap of the iron.


(Kevin) #60

As I feared using too short of a wire is a problem, the other side comes unsoldered and then sticks to the soldering iron and I can’t get it off then I use bad language and curse my creator. I’m going to have to make sure the wire is at least about a centimeter or two in length, and they should all be single runs, trying to tap into a line is even worse because it bisects the thermal transfer (burning a candle from the middle).

It’s also going to be a tremendous help to have the wires pre cut and formed with ends already tinned, so in true form to copy mohits design, he uses a template to bend the wires before constructing them, and it looks like I’ll have to do the same.

They say it isn’t art unless you suffer, I’m not so sure about this deadline though.