Author Topic: DigiSpark + RadioBlock KickStart = Mesh Network in a small package!  (Read 15116 times)

HobbyGuy

  • Newbie
  • *
  • Posts: 2
I came across the RadioBlock Kickstart (http://kck.st/Qc0oDy) and It hit me - RadioBlock + DigiSpark could be a powerful combo. I am in on the Radio Block Kickstart too and I can think of all types of uses from monitoring around the house to swarm robotics, etc. It would be great to see if the two teams could come up with a join project, all in one DigiSparkRadioBlock.
« Last Edit: September 11, 2012, 04:53:50 am by HobbyGuy »

MichaelMeissner

  • Full Member
  • ***
  • Posts: 166
DigiSpark + RadioBlock KickStart = Mesh Network in a small package!
« Reply #1 on: September 18, 2012, 05:11:47 am »
I am a Radioblock backer also.  But before there is a joint project, Radioblock needs to get another $5k to get funded.  Then both teams need to ship their initial projects.  Since the Digispark only has 6 pins, you probably don\'t want to plug the Radioblock directly into the pins like they show on the Radioblock site (where 2 pins are used for ground and 5v, and 2 are used for signalling).

mrmin24

  • Newbie
  • *
  • Posts: 1
DigiSpark + RadioBlock KickStart = Mesh Network in a small package!
« Reply #2 on: September 28, 2012, 06:29:52 am »
I was thinking exactly the same thing. There is just one major problem. The radioblock has a serial interface and the digispark does not. Might have to change one or two things.

JeffRand

  • Newbie
  • *
  • Posts: 44
DigiSpark + RadioBlock KickStart = Mesh Network in a small package!
« Reply #3 on: September 29, 2012, 09:11:09 am »
You can do serial with the digispark. I backed the radioblock just for this purpose.

Trakkasure

  • Newbie
  • *
  • Posts: 28
Re: DigiSpark + RadioBlock KickStart = Mesh Network in a small package!
« Reply #4 on: January 22, 2013, 08:16:48 pm »
Resurrecting this thread....


Has anyone gotten their RadioBlocks working with DigiSpark (SoftwareSerial needs updates first:  http://digistump.com/board/index.php/topic,212.0.html )


It seems to crash after initializing. I'm using pins 4 and 5 for TX/RX.



RadioBlockSerialInterface interface = RadioBlockSerialInterface(-1,-1,4,5);


The negative 1 for the first 2 parameters are so I can plug pins 1&2 of radioblock into the power pins instead.

JeffRand

  • Newbie
  • *
  • Posts: 44
Re: DigiSpark + RadioBlock KickStart = Mesh Network in a small package!
« Reply #5 on: January 23, 2013, 07:29:11 am »
I'm still waiting for my RadioBlocks. Once I get them I will be tinkering with this. I have several projects in mind. Until then, I can't be of much help.  :(

Trakkasure

  • Newbie
  • *
  • Posts: 28
Re: DigiSpark + RadioBlock KickStart = Mesh Network in a small package!
« Reply #6 on: January 23, 2013, 07:48:27 am »
I did post a message on the radioblock forums to try and get their help on this as well.

drodgers

  • Newbie
  • *
  • Posts: 3
Re: DigiSpark + RadioBlock KickStart = Mesh Network in a small package!
« Reply #7 on: February 08, 2013, 04:11:11 am »
I'm interested in this too


I'll help out modifying the serial code if it needs to be done, but I don't really know where to start. Hopefully Erik can shed some light over on the radio-block boards.

JeffRand

  • Newbie
  • *
  • Posts: 44
Re: DigiSpark + RadioBlock KickStart = Mesh Network in a small package!
« Reply #8 on: February 09, 2013, 02:57:00 pm »
Okay, I finally got the digispark to work with the Colorado Micro Devices' RadioBlocks.
I had to make changes to the SoftwareSerial library. In SoftwareSerial.cpp, I made the
following addition. This was the change that Eric @digistump originally suggested, but I
had to tweak the values for 115200 baud, to make it work.

Code: [Select]

 #elif F_CPU == 16500000
static const DELAY_TABLE PROGMEM table[] =
{
  //  baud    rxcenter   rxintra    rxstop    tx
  { 115200,   1,         16,        16,       12,    },
  { 57600,    10,        38,        38,       34,    },
  { 38400,    26,        59,        59,       56,    },
  { 31250,    32,        72,        72,       70,    },
  { 28800,    35,        79,        79,       76,    },
  { 19200,    56,        121,       121,      118,   },
  { 14400,    76,        161,       161,      158,   },
  { 9600,     118,       243,       243,      240,   },
  { 4800,     240,       489,       489,      486,   },
  { 2400,     486,       980,       980,      977,   },
  { 1200,     977,       1961,      1961,     1958,  },
  { 600,      1961,      3923,      3923,     3919,  },
  { 300,      3923,      7855,      7855,     7852,  },
};
const int XMIT_START_ADJUSTMENT = 5;

To connect the RadioBlock, I plugged it directly into the DigiSpark, with VCC on pin 3,
GND on pin 2, RX on pin 1, and TX on pin 0. First, I upload the sketch without the RadioBlock connected. After uploading the sketch, I disconnect the Digispark from the computer, plug in the RadioBlock and then plug the Digispark into a USB wall charger.

DCP_4927 by
Jeff Rand, on Flickr

Here's a simple sketch to blink the LED on the connected RadioBlock.
Code: [Select]
#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1); // RX, TX
void setup(){
  pinMode(2, OUTPUT);
  digitalWrite(2,LOW); // GND on pin 2
  pinMode(3, OUTPUT);
  digitalWrite(3,HIGH); // VCC on pin 3
  mySerial.begin(115200);
}
void loop(){
  delay(500);
  mySerial.print(char(0xAB)); // Start byte
  mySerial.print(char(0x02)); // Size 2 bytes
  mySerial.print(char(0x80)); // Command to set LED status
  mySerial.print(char(0x02)); // Toggle LED
  mySerial.print(char(0x8F)); // Low byte of CRC
  mySerial.print(char(0x4D)); // High byte of CRC
}

Here's another sketch to blink the LED on a remote RadioBlock at adress 0x0001.
Code: [Select]
#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1); // RX, TX
void setup(){
  pinMode(2, OUTPUT);
  digitalWrite(2,LOW); // GND on pin 2
  pinMode(3, OUTPUT);
  digitalWrite(3,HIGH); // VCC on pin 3
  mySerial.begin(115200);
}
void loop(){
  delay(500);
  mySerial.print(char(0xAB)); // Start byte
  mySerial.print(char(0x06)); // Size 6 bytes
  mySerial.print(char(0x20)); // Command to transmit data
  mySerial.print(char(0x01)); // Low byte of remote address
  mySerial.print(char(0x00)); // High byte of remote address
  mySerial.print(char(0x00)); // no options
  mySerial.print(char(0x00)); // no options
  mySerial.print("O");        // Payload to toggle LED
  mySerial.print(char(0x63)); // Low byte of CRC
  mySerial.print(char(0x41)); // High byte of CRC
}

Hope this helps.
 
« Last Edit: February 09, 2013, 03:00:03 pm by JeffRand »

Trakkasure

  • Newbie
  • *
  • Posts: 28
Re: DigiSpark + RadioBlock KickStart = Mesh Network in a small package!
« Reply #9 on: February 19, 2013, 08:35:17 pm »
I just had a chance to work with the code again.
this works! thanks.


I didn't use pins 2 and 3 for power.
And for some reason, after about 2 seconds, the digispark reboots.
If I disable pins 2 & 3 as output, it does not reboot.


Is this because there is no load on pins 2 and 3?

JeffRand

  • Newbie
  • *
  • Posts: 44
Re: DigiSpark + RadioBlock KickStart = Mesh Network in a small package!
« Reply #10 on: February 20, 2013, 04:35:45 am »
Are you sure the digispark is rebooting? Or are you hearing the sound of the USB device unloading?
If you are leaving the digispark plugged into the PC after programming, outputting high on pin 3 will interfere with your USB bus. If you wire power and ground to the radio block separately, freeing up pins 2 and 3. Then, like you said you said, you can eliminate setting pins 2 and 3 as output. I only did this because it was easy to plug the radioblock directly into the digispark and I didn't need the USB bus.
 

Trakkasure

  • Newbie
  • *
  • Posts: 28
Re: DigiSpark + RadioBlock KickStart = Mesh Network in a small package!
« Reply #11 on: February 20, 2013, 08:59:09 am »
Yea. I use the USB bus for power.


That is probably what is happening.

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Re: DigiSpark + RadioBlock KickStart = Mesh Network in a small package!
« Reply #12 on: March 24, 2013, 05:23:04 pm »
Please note that if you haven't done the Burn Bootloader mod to change your bootloader from the 1.02 version which comes with the digispark to the 1.06 version included now with the Digispark Arduino software, your digispark will run at roughly 16.0mhz when not started up with a USB port on an awake computer. This 16.0mhz clock speed is specified as being 10% accurate, so it could be as low as 14.4mhz and as high as 17.6mhz. Upgrading to the 1.06 bootloader calibrates the clock speed during sketch upload and remembers it until the next sketch upload, so if the digispark is operated within a similar temperature environment to where it was programmed, the clock speed should be accurate to within about 0.1%.


Because every digispark is factory calibrated differently, code you get running precisely on one spark may not be accurate on another. Hopefully for future manufacturing runs Digistump will switch to the 1.07 bootloader which should be arriving in a couple of weeks, which free's up some more memory for user programs as well. :)

Stefbar

  • Newbie
  • *
  • Posts: 4
Re: DigiSpark + RadioBlock KickStart = Mesh Network in a small package!
« Reply #13 on: May 17, 2013, 07:35:36 am »
JeffRand I would like to try your sketch to blink a remote LED but it is not clear to me what sketch need to be loaded on the remote RadioBlock to receive the sended command. Can you help me? I'm not an expert in the "Arduino world" and all help is apreciated.
Many thanks
Stefano

JeffRand

  • Newbie
  • *
  • Posts: 44
Re: DigiSpark + RadioBlock KickStart = Mesh Network in a small package!
« Reply #14 on: May 30, 2013, 01:15:06 pm »
JeffRand I would like to try your sketch to blink a remote LED but it is not clear to me what sketch need to be loaded on the remote RadioBlock to receive the sended command. Can you help me? I'm not an expert in the "Arduino world" and all help is apreciated.
Many thanks
Stefano
Stefbar, in my example above, you don't need to connect the remote RadioBlock to anything. So, there is no need for a sketch to be loaded on it.
 
Sorry for the late response to your question.