Show Posts
|
|
Pages: [1] 2 3 ... 9
|
|
2
|
Community / Exhibition / Gallery / 2*2 cm cut-down Arduino Leonardo with radio module
|
on: April 20, 2013, 11:06:49 am
|
Hi guys, I have been working on a miniature, low power wireless remote node based on the ATmega32U4 MCU (the same used in Leonardo Arduino). This is a Open Source Project, all design files and documentation is available here: http://harizanov.com/wiki/wiki-home/funky-sensor-v2/. I wish to say that I am amateur, only started learning electronics on hobby level recently. The highlights are: - 2*2 cm in size, only few mm thick
- can be powered from a CR2032 coin cell
- 0.04mA @ 3V in sleep mode
- Programmed via the USB - just like Arduino Leonardo
- Has a RFM12B radio module for wireless communication with other sensor nodes or another node acting as a gateway (logging the data or forwarding it to the Internet)
- Option for on-board voltage step-up boost regulator
I build these by hand using hot air gun - a slow process, but the outcome is beautiful:  Comments are welcome 
|
|
|
|
|
3
|
Using Arduino / Programming Questions / Re: no matching function for call to 'SerialIPStack::use_device(Serial_&)'
|
on: March 19, 2013, 10:14:18 am
|
It's the included example: https://raw.github.com/beaucollins/arduino-projects/master/libraries/SerialIP/examples/HelloWorldServer/HelloWorldServer.pde/* * SerialIP Hello World example. * * SerialIP is a TCP/IP stack that can be used over a serial port (a bit * like a dial-up Internet connection, but without the modem.) It works with * stock Arduinos (no shields required.) When attached to a PC supporting * SLIP, the Arduino can host network servers and access the Internet (if the * PC is configured to share its Internet connection of course!) * * SerialIP uses the fine uIP stack by Adam Dunkels <adam@sics.se> * * For more information see the SerialIP page on the Arduino wiki: * <http://www.arduino.cc/playground/Code/SerialIP> * * ----------------- * * This Hello World example sets up a server at 192.168.5.2 on port 1000. * Telnet here to access the service. The uIP stack will also respond to * pings to test if you have successfully established a SLIP connection to * the Arduino. * * SLIP connection set up under Linux: * * # modprobe slip * # slattach -L -s 115200 -p slip /dev/ttyUSB0 (see note below) * # ifconfig sl0 192.168.5.1 dstaddr 192.168.5.2 * * # ping 192.168.5.2 * # telnet 192.168.5.2 1000 * * Here 192.168.5.1 is the address you will give to your PC, and it must be * unique on your LAN. 192.168.5.2 is the IP you will give the Arduino. It * must also be unique, and must match the address the Arduino is expecting * as set by the "myIP" variable below. * * Note that slattach won't return so you'll need to run ifconfig from * another terminal. You can press Ctrl+C to kill slattach and release the * serial port, e.g. to upload another sketch. * * This example was based upon uIP hello-world by Adam Dunkels <adam@sics.se> * Ported to the Arduino IDE by Adam Nielsen <malvineous@shikadi.net> */
#include <SerialIP.h>
// The connection_data struct needs to be defined in an external file. #include "HelloWorldData.h"
void setup() {
// Set up the speed of our serial link. Serial.begin(115200);
// Tell SerialIP which serial port to use (some boards have more than one.) // Currently this is limited to HardwareSerial ports, until both it and // SoftwareSerial inherit from a common base class. SerialIP.use_device(Serial);
// We're going to be handling uIP events ourselves. Perhaps one day a simpler // interface will be implemented for the Arduino IDE, but until then... SerialIP.set_uip_callback(uip_callback);
// Set the IP address we'll be using. Make sure this doesn't conflict with // any IP addresses or subnets on your LAN or you won't be able to connect to // either the Arduino or your LAN... IP_ADDR myIP = {192,168,5,2}; IP_ADDR subnet = {255,255,255,0}; SerialIP.begin(myIP, subnet);
// If you'll be making outgoing connections from the Arduino to the rest of // the world, you'll need a gateway set up. //IP_ADDR gwIP = {192,168,5,1}; //SerialIP.set_gateway(gwIP);
// Listen for incoming connections on TCP port 1000. Each incoming // connection will result in the uip_callback() function being called. SerialIP.listen(1000); }
void loop() { // Check the serial port and process any incoming data. SerialIP.tick();
// We can do other things in the loop, but be aware that the loop will // briefly pause while IP data is being processed. }
void uip_callback(uip_tcp_appstate_t *s) { if (uip_connected()) {
// We want to store some data in our connections, so allocate some space // for it. The connection_data struct is defined in a separate .h file, // due to the way the Arduino IDE works. (typedefs come after function // definitions.) connection_data *d = (connection_data *)malloc(sizeof(connection_data));
// Save it as SerialIP user data so we can get to it later. s->user = d;
// The protosocket's read functions need a per-connection buffer to store // data they read. We've got some space for this in our connection_data // structure, so we'll tell uIP to use that. PSOCK_INIT(&s->p, d->input_buffer, sizeof(d->input_buffer));
}
// Call/resume our protosocket handler. handle_connection(s, (connection_data *)s->user);
// If the connection has been closed, release the data we allocated earlier. if (uip_closed()) { if (s->user) free(s->user); s->user = NULL; } }
// This function is going to use uIP's protosockets to handle the connection. // This means it must return int, because of the way the protosockets work. // In a nutshell, when a PSOCK_* macro needs to wait for something, it will // return from handle_connection so that other work can take place. When the // event is triggered, uip_callback() will call this function again and the // switch() statement (see below) will take care of resuming execution where // it left off. It *looks* like this function runs from start to finish, but // that's just an illusion to make it easier to code :-) int handle_connection(uip_tcp_appstate_t *s, connection_data *d) { // All protosockets must start with this macro. Its internal implementation // is that of a switch() statement, so all code between PSOCK_BEGIN and // PSOCK_END is actually inside a switch block. (This means for example, // that you can't declare variables in the middle of it!) PSOCK_BEGIN(&s->p);
// Send some text over the connection. PSOCK_SEND_STR(&s->p, "Hello. What is your name?\n");
// Read some returned text into the input buffer we set in PSOCK_INIT. Data // is read until a newline (\n) is received, or the input buffer gets filled // up. (Which, at 16 chars by default, isn't hard!) PSOCK_READTO(&s->p, '\n');
// Since any subsequent PSOCK_* functions would overwrite the buffer, we // need to make a copy of it first. We can't use a local variable for this, // because any PSOCK_* macro may make the function return and resume later, // thus losing the data in any local variables. This is why uip_callback // has allocated the connection_data structure for us to use instead. (You // can add/remove other variables in this struct to store different data. // See the other file in this sketch, serialip_conn.h) strncpy(d->name, d->input_buffer, sizeof(d->name)); // Note that this will misbehave when the input buffer overflows (i.e. // more than 16 characters are typed in) but hey, this is supposed to be // a simple example. Fixing this problem will be left as an exercise for // the reader :-)
// Send some more data over the connection. PSOCK_SEND_STR(&s->p, "Hello "); PSOCK_SEND_STR(&s->p, d->name);
// Disconnect. PSOCK_CLOSE(&s->p);
// All protosockets must end with this macro. It closes the switch(). PSOCK_END(&s->p); }
|
|
|
|
|
4
|
Using Arduino / Programming Questions / no matching function for call to 'SerialIPStack::use_device(Serial_&)'
|
on: March 19, 2013, 10:02:48 am
|
Hi, I am trying to set the SerialIP example ( http://playground.arduino.cc/Code/SerialIP ) working on an Arduino Leonardo, but I am getting no matching function for call to 'SerialIPStack::use_device(Serial_&)' on this line: SerialIP.use_device(Serial); If I replace "Serial" with "Serial1" (the hardware serial) all compiles, but I don't want the Serial1, but the CDC virtual Serial port so I can plug the Arduino to a Linux box. The comment to the above line states // Tell SerialIP which serial port to use (some boards have more than one.) // Currently this is limited to HardwareSerial ports, until both it and // SoftwareSerial inherit from a common base class.
but I am sure there has to be a way to pass the serial as argument. Please help 
|
|
|
|
|
6
|
Using Arduino / Microcontrollers / Custom atmega32u4+RFM12b board: high current draw in sleep mode
|
on: March 13, 2013, 07:17:03 am
|
Guys, I am trying go get a FOSS project going, namely a miniature, battery operated atmega32u4 node with a RFM12B module on it, called it 'Funky'. I am very unexperienced, just recently started hobby level learning electronics, so please be forgiving. Wiki page http://harizanov.com/wiki/wiki-home/funky-sensor-v2/Schematic: http://harizanov.com/wp-content/uploads/2013/03/IMG_2007-1024x768.jpg So my trouble is that I can't get decent sleep currents, the lowest I get is 3mA using this Arduino code: #include <avr/power.h> #include <avr/sleep.h>
#include <JeeLib.h> // https://github.com/jcw/jeelib #include "pins_arduino.h"
ISR(WDT_vect) { Sleepy::watchdogEvent(); } // interrupt handler for JeeLabs Sleepy power saving
#define myNodeID 27 // RF12 node ID in the range 1-30 #define network 210 // RF12 Network group #define freq RF12_868MHZ // Frequency of RFM12B module
#define LEDpin 1
void setup() {
pinMode(LEDpin,OUTPUT); digitalWrite(LEDpin,HIGH);
rf12_initialize(myNodeID,freq,network); // Initialize RFM12 with settings defined above // Adjust low battery voltage to 2.2V rf12_control(0xC040); rf12_sleep(0); // Put the RFM12 to sleep digitalWrite(LEDpin,LOW); power_adc_disable(); power_usart0_disable(); //power_spi_disable(); power_twi_disable(); //Leave timer 0 going for delay() function power_timer1_disable(); power_timer2_disable(); power_timer3_disable(); power_usart1_disable();
// Datasheet says that to power off the USB interface we have to do 'some' of: // Detach USB interface // Disable USB interface // Disable PLL // Disable USB pad regulator
// Disable the USB interface USBCON &= ~(1 << USBE); // Disable the VBUS transition enable bit USBCON &= ~(1 << VBUSTE); // Disable the VUSB pad USBCON &= ~(1 << OTGPADE); // Freeze the USB clock USBCON &= ~(1 << FRZCLK); // Disable USB pad regulator UHWCON &= ~(1 << UVREGE); // Clear the IVBUS Transition Interrupt flag USBINT &= ~(1 << VBUSTI); // Physically detact USB (by disconnecting internal pull-ups on D+ and D-) UDCON |= (1 << DETACH);
digitalWrite(LEDpin,LOW);
cli(); SMCR |=(1<<SM1);//Power down SMCR |=(1<<SE); //Enable sleep mode __asm__ __volatile__ ("sleep" "\n\t" :: );
// I expect uA readings here, but get 3mA... }
void loop() { }
Any tips are welcome, is it a hardware design issue, or software consideration? [edit] I realize I didn't mention it, but I power the board from a 3.3V source directly at the VCC pin. I don't have the LTC3525 boost regulator circuitry poplated for this board build, jut the MCP1703. I tried completely unsoldering it after I programmed the board with the test sketch, but no improvement happened. I also experimented with fuses, disabling BOD, switching clock source from the external crystal to internal one.
|
|
|
|
|
8
|
Using Arduino / Microcontrollers / Re: Bootloader for Tiny chips?
|
on: August 26, 2012, 08:37:50 am
|
Tom, this is great news. I have quite a few projects on Attiny84 and have been looking for a bootloading solution for quite some time now.. Do you plan to document this and release your modifications? edit: got too excited and didn't read carefully 
|
|
|
|
|
14
|
Using Arduino / Microcontrollers / Re: Optiboot on Attiny84?
|
on: June 21, 2012, 10:07:01 am
|
Thanks Coding Badly, I hope I grow to fully understand what you are saying one day  As for the: • ATtiny processors do not have a mechanism for protecting the bootloader. If an application is "too big" there is the possibility of overwriting the bootloader.
I think the Optiboot has a build flag for that, called VIRTUAL_BOOT_PARTITION, the bootloader itself can ensure that it won't get self-erased.
|
|
|
|
|
15
|
Using Arduino / Microcontrollers / Re: Optiboot on Attiny84?
|
on: June 21, 2012, 10:01:35 am
|
Here is my 'progress' or at least steps I undertook so far: I modified the optiboot makefile to change the AVR_FREQ to 8Mhz, as I will be runnint the Attiny on its internal oscillator: luminet: TARGET = luminet luminet: MCU_TARGET = attiny84 luminet: CFLAGS += '-DLED_START_FLASHES=3' '-DSOFT_UART' '-DBAUD_RATE=9600' luminet: CFLAGS += '-DVIRTUAL_BOOT_PARTITION' luminet: AVR_FREQ = 8000000L luminet: LDSECTIONS = -Wl,--section-start=.text=0x1d00 -Wl,--section-start=.version=0x1efe luminet: $(PROGRAM)_luminet.hex luminet: $(PROGRAM)_luminet.lst
I burned the OptiBoot bootloader and am able to see the led on PA7 blink three times as expected. avrdude -c usbtiny -p attiny84 -e -u -U lock:w:0x3f:m -U efuse:w:0xFE:m -U hfuse:w:0xDF:m -U lfuse:w:0x62:m avrdude -c usbtiny -p attiny84 -U flash:w:optiboot_luminet.hex
I modified my boards.txt to add a new section as follows: ############################################################## attiny84.name=ATtiny84 Optiboot attiny84.upload.protocol=stk500 //tried 'arduino' as well attiny84.upload.maximum_size=7424 attiny84.upload.speed=9600 attiny84.build.mcu=attiny84 attiny84.build.f_cpu=8000000L attiny84.build.core=tiny
I hooked up the FTDI cable, TX and RX as follows: /* Ports for soft UART - left port only for now. TX/RX on PA2/PA3 */
.. and yes, I tried swapping the lines just in case. I hooked up a 0.1uF ceramic capacitor in series with the RtS line on the FTDI I try to upload a sketch, but get: Using Port : COM20 Using Programmer : stk500v1 Overriding Baud Rate : 9600 avrdude: Send: 0 [30] [20] avrdude: Send: 0 [30] [20] avrdude: Send: 0 [30] [20] avrdude: Recv: avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude done. Thank you.
Comments are welcome 
|
|
|
|
|