Funky v3

Revision for “Funky v3” created on March 26, 2015 @ 08:28:11

Funky v3
<h2>Funky v3</h2> This is v3 of my "Funky" Arduino clone, specifically designed to be <span style="text-decoration: underline;">small</span>, with <span style="text-decoration: underline;">on-board radio module</span> and for <span style="text-decoration: underline;">low power</span> applications. <h3></h3> <hr /> <h3>Highlights</h3> <ul> <li>Board size is 20×21.2mm (0.78″x0.83″)</li> <li>Weighs 3 grams (0.11 oz)</li> <li>Compatible with <a href="" target="_blank">Arduino IDE</a></li> <li><a href="" target="_blank">ATMega32U4</a> MCU, the same as processor used in the popular <a href="" target="_blank">Arduino Leonardo</a></li> <li>No need for external programmer to upload new sketch - just use micro USB cable</li> <li>Equipped with 433/868 wireless <a href="" target="_blank">RFM12B </a>or <a href="" target="_blank">RFM69CW </a>transceiver module</li> <li>Runs on 8 Mhz and can be powered from 2.7-3.3V power source, including coin cell battery</li> <li>Low power operating mode</li> </ul> <hr /> <h3>Board schematic &amp; layout</h3> Funky v3 schematic and board layout files are available on <a href="" target="_blank">GitHub</a> [gallery columns="2" ids="3652,3654"] <hr /> <h3> Pins legend</h3> <ul> <li>Pins mapping:[gallery columns="2" size="medium" ids="3722,3723"]</li> </ul> <hr /> <h3> Powering it up</h3> <ul> <li>Via the USB <ul> <li>Simply plug in the Funky to micro USB cable and it will be powered up.</li> <li>NOTE: Please remove any battery attached when plugging into USB.</li> </ul> </li> <li>Coin cell (CR2032) <ul> <li>Coin cell holder can be directly soldered on the bottom of Funky v3</li> <li>[gallery columns="1" size="medium" ids="3692"]</li> <li>If you wish to use CR2032 battery in combination with the optional LTC3525 boost regulator, you will need to bend the positive pin and route that with a wire to the boost regulator entry.</li> </ul> </li> <li>AA(A) Batteries <ul> <li>Use two AA(A) batteries on the VCC and GND to supply 3V to the Funky v3</li> <li>Use 3 AA(A) batteries connected to the 5V and GND to supply 4.5V to the on-board LDO that will regulate it to 3.3V</li> </ul> </li> <li>Boost Regulator <ul> <li>The board carries an option for the <a href="">LTC3525ESC6</a> (3.3V version) boost regulator and supporting elements to be included, this is useful when you wish to power the board from a 0.8 – 5.5V source and get that regulated to 3.3V.</li> <li>[gallery size="medium" ids="3712,3711,3713"]</li> </ul> </li> <li>Side Headers <ul> <li>Funky v3 can be powered from the side headers (3.3V and 5V possible)</li> <li>If your project requires it, you may solder 6x2 headers to the side pins and another 4x2 on the bottom pins as shown below</li> <li>[gallery columns="1" size="medium" ids="3693"]</li> <li>The header pins will require slight filing to shorten the metal pins length for best fit</li> </ul> </li> </ul> <hr /> <h3> Arduino IDE</h3> <ul> <li>Setting up <ul> <li>Download and install the latest <a title="Arduino IDE" href="" target="_blank">Arduino IDE</a> from the official Arduino site. Setting it up is straight forward.</li> </ul> </li> <li>Chose the board type <ul> <ul> <li>Select "<strong>LilyPad Arduino USB</strong>" as board type, it uses the same MCU/Clock speed as the Funky v3, so I have decided to use that as board type rather than own custom board type that would require more difficult user setup:</li> </ul> </ul> [caption id="attachment_3656" align="aligncenter" width="150"]<a href=""><img class="wp-image-3656 size-thumbnail" src="" alt="ArduinoIDE" width="150" height="150" /></a> Click to enlarge[/caption]</li> <li>Libraries <ul> <li>Using the RFM12B/RFM69CW transceiver will require that you <a href="" target="_blank">install </a>the <a href="" target="_blank">Jeelib </a>library</li> </ul> </li> </ul> Using the <a href="" target="_blank">RFM69CW</a> radio module instead of the RFM12B is possible, just make sure you include the following define: <pre><strong>#define RF69_COMPAT 1</strong> // define this to use the RF69 driver i.s.o. RF12</pre> The RFM69CW module must be initialized as soon as possible in the sketch as until initialized, it is quite power-hungry and will brown-out the Funky v3 after a short while. A 10uF 0805 SMD ceramic capacitor must be soldered on the boost regulator circuitry to support the RFM69CW module. It also uses double the transmission power to that of a RFM12B (45mA compared to 23mA), so may be less suitable for low-power operation mode. <ul> <li>Uploading new sketch <ul> <li>Just hit the 'Upload' button in Arduino IDE.</li> <li>If for some reason the sketch won't upload, hit the 'Reset' button on the Funky v3 just when the IDE starts looking for the board, this is easily identifiable by the text "<strong><em>PORTS {} / {} =&gt; {}</em></strong>" in the debug window as pictured below:</li> <li>[gallery columns="2" size="medium" ids="3686,3658"]</li> </ul> </li> <li>The module comes with bootloader and the <a href="" target="_blank">RF12Demo</a> sketch installed, so you may start toying immediately.</li> <li>Blinky example <ul> <li>Grab the Blink example from <a href="" target="_blank">GitHub </a>and upload to the board. The on-board LED should blink every second</li> <li>LED is connected to pin digital 13</li> </ul> </li> </ul> <hr /> <h3></h3> <h3>Using the RFM12B/RFM69CW</h3> <ul> <li>Prerequisite: the Jeelib Arduino library, see the above "Library" section</li> <li>Powering up the module <ul> <li>The RFM12B module must be explicitly powered up by writing LOW to Digital 4. Make sure to power up the module *before* any attempt to initialize it, otherwise it will simply fail.</li> <li> <pre> pinMode(4,OUTPUT); // Funky v3 RFM12B power control pin digitalWrite(4,LOW); //Make sure the RFM12B is on, yes LOW is ON delay(100); // Delay (or sleep) to allow the RFM12B to start up </pre> </li> </ul> </li> <li>Initializing the radio module <ul> <li>The following code will initialize the RFM module to NodeID=22, 868Mhz and network group of 210</li> <li> <pre>rf12_initialize(22,RF12_868MHZ,210); rf12_control(0xC000); // Adjust low battery voltage to 2.2V, only for RFM12B rf12_sleep(0); // Put the RF module to sleep </pre> </li> </ul> </li> </ul> <ul> <li>Send example <ul> <li>The following code will send a payload structure over the radio link</li> <li> <pre>typedef struct { int temp; // some structure as payload } Payload; Payload temptx; rf12_sleep(-1); // Wake up RF module while (!rf12_canSend()) rf12_recvDone(); rf12_sendStart(0, &amp;temptx, sizeof temptx); rf12_sendWait(2); // Wait for RF to finish sending while in standby mode </pre> </li> </ul> </li> </ul> <hr /> <h3></h3> <h3>Low power</h3> Running on batteries requires special care to cut power consumption to its lowes possible. This is possible by both hardware architecture and software code. <ul> <li>Detecting USB <ul> <li>It makes sense to keep USB connectivity ON when we are powered by the USB and not running on battery power. That enables us to use serial debugging/configuration of the module. To identify if we are running on battery or plugged into USB, use the following code:</li> <li> <pre> USBCON = USBCON | B00010000; delay(550); // Necessary, some systems may even require longer delay if (UDINT &amp; B00000001){ // USB Disconnected; We are running on battery so we must save power } else { // Running on USB power, we can be wasteful }</pre> </li> </ul> </li> <li>The following code will reduce power usage to maximum possible extend by switching off certain peripherals and switching to the internal RC rather than the external crystal. This will allow the Funky v3 to run longer on battery.The code will disable USB connectivity, so you will need to hit the 'Reset' button to upload a new sketch: <ul> <li> <pre> ADCSRA =0; power_adc_disable(); ACSR |= (1 &lt;&lt; ACD); // disable Analog comparator, saves 4 uA power_usart0_disable(); //power_spi_disable(); /do that a bit later, after we power RFM12b down power_twi_disable(); power_timer0_disable(); // Do not disable if you need millis()!!! power_timer1_disable(); power_timer3_disable(); PRR1 |= (uint8_t)(1 &lt;&lt; 4); //PRTIM4 power_usart1_disable(); // Switch to RC Clock UDINT &amp;= ~(1 &lt;&lt; SUSPI); // UDINT.SUSPI = 0; Usb_ack_suspend USBCON |= ( 1 &lt;&lt;FRZCLK); // USBCON.FRZCLK = 1; Usb_freeze_clock PLLCSR &amp;= ~(1 &lt;&lt; PLLE); // PLLCSR.PLLE = 0; Disable_pll CLKSEL0 |= (1 &lt;&lt; RCE); // CLKSEL0.RCE = 1; Enable_RC_clock() while ( (CLKSTA &amp; (1 &lt;&lt; RCON)) == 0){} // while (CLKSTA.RCON != 1); while (!RC_clock_ready()) CLKSEL0 &amp;= ~(1 &lt;&lt; CLKS); // CLKSEL0.CLKS = 0; Select_RC_clock() CLKSEL0 &amp;= ~(1 &lt;&lt; EXTE); // CLKSEL0.EXTE = 0; Disable_external_clock // Datasheet says that to power off the USB interface we have to: // Detach USB interface // Disable USB interface // Disable PLL // Disable USB pad regulator // Disable the USB interface USBCON &amp;= ~(1 &lt;&lt; USBE); // Disable the VBUS transition enable bit USBCON &amp;= ~(1 &lt;&lt; VBUSTE); // Disable the VUSB pad USBCON &amp;= ~(1 &lt;&lt; OTGPADE); // Freeze the USB clock USBCON &amp;= ~(1 &lt;&lt; FRZCLK); // Disable USB pad regulator UHWCON &amp;= ~(1 &lt;&lt; UVREGE); // Clear the IVBUS Transition Interrupt flag USBINT &amp;= ~(1 &lt;&lt; VBUSTI); // Physically detact USB (by disconnecting internal pull-ups on D+ and D-) UDCON |= (1 &lt;&lt; DETACH); power_usb_disable(); // Keep it here, after the USB power down // Initialize and put the RFM12B to sleep, make sure it is powered before attempting to talk to it.. rf12_initialize(storage.myNodeID,storage.freq,,1600); // Initialize RFM12 // Adjust low battery voltage to 2.2V rf12_control(0xC000); rf12_sleep(0); // Put the RFM12 to sleep power_spi_disable(); </pre> </li> </ul> </li> <li>Sleeping <ul> <li>You can put the  MCU to sleep to save power</li> <li> <pre>for(int j = 0; j &lt; 1; j++) { // Sleep for j minutes Sleepy::loseSomeTime(60000); //JeeLabs power save function: enter low power mode for x seconds (valid range 16-65000 ms) } </pre> </li> </ul> </li> <li>Pin Change Interrupts</li> </ul> The <a href="" target="_blank">RFM12B_test example sketch </a>will <ul> <li>Detect if connected to USB</li> <li>If connected to USB, it will run a configuration menu on serial for 20 seconds</li> <li>If will send a payload structure of a incrementing value and VCC readout every 20 seconds</li> </ul> &nbsp; This project is licensed under a <a href="" rel="license">Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License</a>. <a href="" rel="license"><img style="border-width: 0;" src="" alt="Creative Commons License" /></a>

OldNewDate CreatedAuthorActions
March 26, 2015 @ 08:28:11 Martin
March 26, 2015 @ 08:26:40 [Autosave] Martin
February 18, 2015 @ 16:43:11 Martin
February 18, 2015 @ 16:26:25 Martin
February 18, 2015 @ 11:42:07 Martin
February 18, 2015 @ 11:06:53 Martin
February 17, 2015 @ 17:22:02 Martin
February 17, 2015 @ 11:57:03 Martin
February 8, 2015 @ 13:38:28 Martin
January 29, 2015 @ 22:21:02 Martin
January 29, 2015 @ 22:04:37 Martin
January 29, 2015 @ 21:59:22 Martin
January 29, 2015 @ 17:12:55 Martin
January 29, 2015 @ 17:07:14 Martin
January 29, 2015 @ 17:04:39 Martin
January 29, 2015 @ 16:46:22 Martin
January 29, 2015 @ 16:22:13 Martin
January 29, 2015 @ 16:02:35 Martin
January 28, 2015 @ 16:00:29 Martin
January 28, 2015 @ 15:24:37 Martin

11 thoughts on “Funky v3

  1. Pingback: Using DS18B20/DHT22 temperature sensor with internal pull-up resistors rather than external ones | Martin's corner on the web

  2. Pingback: Spectrum analysis with RFM12B | Martin's corner on the web

  3. Hi Martin,

    in some of your blogs I found the hint to look into your webshop — and especially for this nice little device here I would be interested to buy one. Is this possible? Your homepage does not show any “shop” link — at least I cannot find one … I think once it was there?!

    Thanks a lot in advance!

    • Hello,
      yes, there used to be a shop where I’d sell the exta units I had..I don’t have free time to support it any more, plus am out of stock on products.


      • Martin,

        is there anything available on the market that comes close to the Funky? It is exactly what I’m looking for, but I don’t have the means to fabricate the board myself…


        • Hi,
          Have you tried the Moteino? The form factor isn’t same, but function-wise should be just fine.
          I do have few left, just less the radio modules. How many units do you need?

  4. Hey Martin,
    Thanks for great early work on the Funky boards. I have two questions I hope you can answer from your experience:

    1.) Since you have both the boost regulator (which works on battery power) and the linear voltage regulator (which works on USB, based on schematic), how is the performance in general? What I’m specifically interested in knowing is – on battery power, is the MCP1703 happy with having 3.3V on its VO pin (from the boost) and nothing on it’s input? Or do we see some reverse current flow back through it and turn it on? Same thing for the boost – when powered by USB, is the boost regulator still switched off with 3.3V on its output (from the linear reg) or is it reverse powered?

    2.) What’s the function of the MOSFET on pin D4? It looks like it turns the radio on/off when needed, but not sure why D4 is also connected to RESET.


Comments are closed.