Hello! After strugglin a bit with the WifiBee and COSM data streamin, I would like, if its possible, to post my code here, so anyone can use it and modify it as they like, and If any error or improvement is found, it will be welcome!

I post this, because many google results and post are focused on old pachube site, where the hostname, url, and feedID may vary. I read the entire COSM manual/wiki to findout that the values are sent in this form


Wich in most codes is not explained, and on the WifiBee wiki, there is a code, wich, there was no clue wich streamID was the data sent to. And the COSM site has a code, focused to the ethernet shield, wich i read entirely to find clues on how to send the data. anyways… I hope this saves some time to some poeple interested on make COSM and Wishield get along.

This code WORKS. It send a random value to a COSM feed.

The library I used is this one:


And following this post to make ir work on latest Arduino IDE


In order to get rid of these error you need to change the corresponding names in the following files:

Replace #include “wiring.h” with #include “Arduino.h”

Replace #include “WProgram.h” to #include “Arduino.h”

Replace #include “WProgram.h” to #include “Arduino.h”
Replace void Server::write(uint8_t… to be size_t Server::write(uint8_t…

Replace virtual void write(uint8_t); to virtual size_t write(uint8_t);

Now, the code:

/* to work, modify apps-conf.h file as below ; only APP_WISERVER mode is enabled : 
//Here we include the header file for the application(s) we use in our project.
//#define APP_SOCKAPP
//#define APP_UDPAPP
#include <WiServer.h>
// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,1,22};	// IP address of WifiBee !!!! Caution, dependin on your router, this value might be different
unsigned char gateway_ip[] = {192,168,1,1};	// router or gateway IP address !! Caution, dependin on your router, this value might be different
unsigned char subnet_mask[] = {255,255,255,0};	// subnet mask for the local network
const prog_char ssid[] PROGMEM = {"HOME"};// max 32 bytes, this is your wifi ssid
unsigned char security_type = 3;	// 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2 replace with the one that fits your WiFi settings
// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"123456789"};	// max 64 characters, this is you wifi password
// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = 
{ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d,	// Key 0
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,	// Key 1
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,	// Key 2
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00	// Key 3
// setup the wireless mode
// infrastructure - connect to AP
// adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;
unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters ----------------------------------------
// Function that prints data from the server
void printData(char* data, int len) {
  // Print the data returned by the server
  // Note that the data is not null-terminated, may be broken up into smaller packets, and 
  // includes the HTTP header. 
  while (len-- > 0) {
int sensorValue=0;
String feedID="stream"; //Change to you stream name
//Prepare data to the feed
void feedData() 
   //the data is sent as <streamID>,<value>
   sensorValue=random(255);   //Random vlaue that will be sent to COSM page
// IP Address for api.cosm.com
uint8 ip[] = {173,203,98,29};
char hostName[] = "api.cosm.com\nX-ApiKey: YOUR_API_KEY_HERE\nConnection: close"; // Replace YOUR_API_KEY_HERE , with your API key
char url[] = "/v2/feeds/12345.csv?_method=put"; //Replace 12345 with your feed number
// A request that POSTS data to Pachube
POSTrequest postFeed(ip, 80, hostName, url, feedData);
void setup() {
    // Initialize WiServer (we'll pass NULL for the page serving function since we don't need to serve web pages) 
  // Enable Serial output and ask WiServer to generate log messages (optional)
  // Have the processData function called when data is returned by the server
// Time (in millis) when the data should be retrieved 
long updateTime = 0;
void loop(){
  // Check if it's time to send an update
  if (millis() >= updateTime) {
    // Send another update after a min
    updateTime += 60;
  // Run WiServer

You can check it here

https://cosm.com/feeds/128511 //Select 1week or month display of data… I sent a few streams just to try it.