Skip navigation
2015

  

     UPDATED: Check out this video of the first UNO made in the USA, which now belongs to Massimo Banzi!

Arduino Due Insert     With all the controversy swirling around the legal battle between Arduino LLC (hereafter referred to simply as 'Arduino', for simplicity's sake) and Smart Projects, many have hinted at the major problems faced by Massimo Banzi and the Arduino founders. Since their manufacturing arm has been severed, they have scrambled to keep the company in the black, all the while attempting to fight what will surely become a major legal battle. Though there have only been hints, we can take an educated guess at the damage this has caused Arduino's bottom line – some have gone so far as to say that it could lead to the collapse of the company as we know it.

     However, this weekend at Maker Faire, it seems that Banzi and the team at Arduino were thrown the life raft they so desperately needed – Adafruit, one of the biggest companies in the 'Maker' scene, has signed a contact to become Arduino's manufacturer. What this means, from what we have heard so far, is that Adafruit will manufacture all the official Arduino boards under license from Arduino – what remains to be seen, and what is on everyone's mind, is whether Smart Projects will try and block this development legally.

     For those not in the loop, I would recommend checking out this Hackaday article, and also this follow-up. To break it down in simple terms, one of the original founders of Arduino started a company called Smart Projects to handle the manufacturing arm of the business. All the boards are made by Smart Projects under license from Arduino (check out the photo of the insert from my Arduino Due box). However, it is alleged that in 2008 the founder who created Smart Projects secretly registered the Arduino trademark in Italy – which the Arduino team didn't discover until they attempted to register the trademark elsewhere in the world. Arduino then discovered that Smart Projects had registered the trademark and attempted to negotiate a happy ending for everyone, but were unsuccessful – now Smart Projects continues to manufacture the boards but refuses to pay the royalty due under the original license. Smart Projects then renamed their company to Arduino SRL, and registered the domain arduino.org – leading to some mass confusion among supporters, as the websites look identical. This has lead to the aforementioned lack of funds and the increasingly desperate situation for Arduino LLC.

     Adafruit, among many other electronics distributors, declared their support of the original group of founders under the Arduino LLC name, and now have thrown their not-unsubstantial weight behind that declaration. This is almost certainly the boost that they needed to push forward with the legal battle. With this announcement comes many more questions – how will consumers know which company they are supporting? Who will carry which version of which Arduino product? Will Adafruit be able to support the mass manufacturing needed to keep up with demand? It will be very interesting to see how this all turns out.

I am very curious to hear which side the community supports – please leave your comments and ideas below!

Hey there,

I know that this section is dedicated to the Arduino board, but since there's no blog section for the ESP8266 I've decided to post it here.

A few weeks ago I've posted on my blog a tutorial where I built a web server with an ESP8266.

There's no need to use another microcontroller, all the work is done done by the ESP8266.

 

Here's the complete tutorial:http://randomnerdtutorials.com/esp8266-web-server
And below you can watch a video demonstration of this project

 

Thank you for reading,

-Rui

P.S. Click here to read the complete ESP8266 web server tutorial

In order to control our plants via Dropbox we built the following circuit / cyber physical system / IoT application. You might notice that the Arduino, the wired components and the irrigation run "autonomous". This is another aspect of our project, to increase sustainable gardening. The water comes from a natural pond, the power from an old automotive battery/solar panel. This project was part of a thesis and the advanced development / recursive modelling has been performed with SysML to verify applicability of Model Based Systems Engineering (MBSE) in the context of IoT.

 

{gallery} Layout

Screen Shot 2015-05-16 at 12.55.46.png

Layout:

SmarDen_schem.png

Schema:

{gallery} Dropbox GUI and Hardware

Screen Shot 2015-05-16 at 11.50.58.png

Measured data: Battery level; Humidity; Temperature; XBee connection; Water level

Screen Shot 2015-05-16 at 11.50.33.png

Camera: Growth progress

Screen Shot 2015-05-16 at 11.49.40.png

Arduino: Components

Screen Shot 2015-05-16 at 11.49.18.png

Battery:

Screen Shot 2015-05-16 at 11.49.59.png

Solar panel

Arduino code:

#include <MemoryFree.h>
#include <avr/wdt.h>
#include <avr/sleep.h>
#include <avr/power.h>


#include "pb_encode.h"
#include "pb_decode.h"
#include "messages_pb.h"


#include <SoilHumidity2.h>
#include <LM35.h>


//#include <AltSoftSerial.h>
#include <SoftwareSerial.h>


#include <JPEGCamera.h>


// sensors


SoilHumidity2 hsensor(3, 1); // soil resistance sensor: digital out pin, analog in pin
LM35 tsensor(0); // temperature sensor: analog in pin


const int batVPin = 2;   // bat level analog pin
const int waterVPin = 3; // water level in pin
const int waterOPin = 5; // water level sensor digital out pin
const int pumpOPin = 6;  // pump digital out pin


long pumpEndT = -1; // time to turn pump off, -1 if pump is off


long lastCommand = millis(); // time of last command. if we do not receive a command within 2 min. we go to sleep for 56 secs -> save power
int pumpBattLevel = 0;  // level of bat while pumping


const int WATER_LEVEL = 400;




// communication
SoftwareSerial s(8,9);      // cam serial
SoftwareSerial s2(10,11);  // xbee serial




JPEGCamera cam(s);




// xbee comm protocol
const unsigned int MAGIC = 7557; // frame prefix


messages_SensorData sensorData;
messages_Command commandData;
messages_picData picData;
messages_Ok okData;


char rBuffer[16];      // read buffer
uint8_t wBuffer[32];   // write buffer
pb_ostream_t stream;




// xbee comm protocol parsing
int readState = 0; // 0: magic_h, 1: magic_l, 2: len_h, 3: len_l, 4: buffer
int readExpectedLen = 0;
int m;
uint8_t h;
uint8_t l;


uint8_t command = 255;
int command_arg;


// control led
int led = 13;
int value = HIGH;


// power control
volatile long sleepOn = 0;
int powerPin = 12;


void softReset() // Restarts program from beginning but does not reset the peripherals and registers
{
  asm volatile ("  jmp 0");
}




ISR(WDT_vect)
{
  //Serial.println("ISR");
  if (sleepOn > -1)
  {
  }
  else
  {
    softReset();
  }
}




void setupWDT()
{
  /*** Setup the WDT ***/


  /* 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);
}


void enterSleep()
{
//   set_sleep_mode(SLEEP_MODE_PWR_SAVE);   /* EDIT: could also use SLEEP_MODE_PWR_DOWN for lowest power consumption. */
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);   /* EDIT: could also use SLEEP_MODE_PWR_DOWN for lowest power consumption. */


  /* Now enter sleep mode. */
  sleep_enable();
  sleep_mode();






}


void camSave()
{
  /*
   s.begin(38400);
    s.listen();
  wdt_reset();
  cam.reset();
  delay(6000);
  wdt_reset();
  cam.powerSaving(true);
  */
}




void sleepIt(long duration)
{
  LEDLow();
  sleepOn = duration/8000;
  if (sleepOn == 0)
    sleepOn = 1;
  digitalWrite(powerPin, LOW);
  while (sleepOn)
  {
    enterSleep();
  /* The program will continue from here after the WDT timeout*/
    sleepOn--;
  }
  sleep_disable(); /* First thing to do is disable sleep. */

  /* Re-enable the peripherals. */
  power_all_enable();
  delay(100);
  digitalWrite(powerPin, HIGH);


// camSave();
}




// parse xbee comm
void doSerial()
{
  s2.listen();
  //Serial.println("event");
  while (s2.available())
  {
    invertLED();
    switch (readState)
    {
    case 0:
      h = s2.read();
      if (h == highByte(MAGIC))
        readState = 1;
      break;
    case 1:
      l = s2.read();
      m = word(h,l);
      if (m != MAGIC)
        readState = 0;
      else
      {
        readState = 2;
      }
      m = 0;
      break;
    case 2:
      h = s2.read();
      readState = 3;
      break;
    case 3:
      l = s2.read();
      readExpectedLen = word(h, l);
      // Serial.print("len ");
      //  Serial.println(readExpectedLen, DEC);
      if (readExpectedLen > 32)
      {
        readState = 0;
      }
      else
      {
        readState = 4;
      }
      break;
    case 4:
      if (s2.readBytes(rBuffer, readExpectedLen) == readExpectedLen)
      {
        pb_istream_t stream = pb_istream_from_buffer((uint8_t *)rBuffer, sizeof(rBuffer));
        pb_decode(&stream, messages_Command_fields, &commandData);
        command = commandData.command;
        //  Serial.print(7,DEC);
        //  Serial.println(command,DEC);
      }
      readState = 0;
      break;
    default:
      readState = 0;
      break;
    }
  }
}




void setup()
{
  stream = pb_ostream_from_buffer(wBuffer, sizeof(wBuffer));
  s2.begin(9600);    // set low xbee baudrate to reduce error rate.
  s.begin(38400);    // default cam baudrate is 38400
//  Serial.begin(9600);  // use serial for debug, but may block if used together with software serial
//  Serial.println("setup");
  pinMode(led, OUTPUT);
  pinMode(batVPin, INPUT);
  pinMode(waterVPin, INPUT);
  pinMode(waterOPin, OUTPUT);
  pinMode(pumpOPin, OUTPUT);
  pinMode(powerPin, OUTPUT);
  // turn xbee on
  digitalWrite(powerPin, HIGH);


setupWDT();
lastCommand = millis();


// camSave();

// set LED to high
LEDHigh();
   // wdt_enable(WDTO_8S);   // set watchdog to 8 seconds. may be set lower in future


}


void loop()
{
  wdt_reset();   // trigger watchdog
  if (pumpEndT > 0 && pumpEndT < millis())  // check if pump is on
    offPump();
  doSerial();  // parse input
  if (command < 255)  // if we received a command: execute it
  {
    lastCommand = millis();
    invertLED();
    wdt_reset();
    doCommand();
    command = 255;
    // Serial.print(0,DEC);
    // Serial.print(command, DEC);
  }
  else
  {
    if (pumpEndT <= 0 && (millis() - lastCommand) > 60000)
    {
      sleepIt(56000);
      lastCommand = millis()-55000;
    }
  }



}


void LEDHigh()
{
   value = LOW;
invertLED();
}


void LEDLow()
{
   value = HIGH;
invertLED();
}


void invertLED()
{
  if (value == HIGH)
    value = LOW;
  else
    value = HIGH;
  digitalWrite(led, value);
}


void doPump()
{


  pb_ostream_t stream = pb_ostream_from_buffer(wBuffer, sizeof(wBuffer));
  if (pb_encode(&stream, messages_Ok_fields, &okData))
  {
    //Serial.print("b ");
    //Serial.println(stream.bytes_written, DEC);
     sendMessage(stream.bytes_written);
  }
//     else
//  Serial.println("error encoding ok in doPump");


  long duration = commandData.arg;
// Serial.print(millis(), DEC);Serial.print(" doPump ");Serial.println(duration, DEC);
  if (duration > 0)  // duration 0 == heart beat
  {
    pumpEndT = millis()+duration;
    digitalWrite(pumpOPin, HIGH);
    delay(500);
    pumpBattLevel = getBatLevel(); // get bat level only when bat is under load
  }


}


void doSleep()
{
  long duration = commandData.arg;

  pb_encode(&stream, messages_Ok_fields, &okData);


  sendMessage(stream.bytes_written);


  if (duration > 0)  // duration 0 == heart beat
  {
    sleepIt(duration);
  }


}


int getBatLevel()
{
   return analogRead(batVPin);
}


void getWaterLevel()
{
  digitalWrite(waterOPin, HIGH);
  delay(500);
  int x = analogRead(waterVPin);
  digitalWrite(waterOPin, LOW);
  bool hasWater = x > WATER_LEVEL;
  sensorData.hasWater = hasWater;
}


void offPump()
{
  //  Serial.print(millis(), DEC);Serial.println(" offPump");
  pumpEndT = -1;
  digitalWrite(pumpOPin, LOW);
}


void sendPic()
{
  // Serial.println();
  // Serial.println(9, DEC);
  // Serial port connected to the cam
  s.listen();
  delay(1000);
  cam.reset();
  delay(4000);
  wdt_reset();
// cam.powerSaving(false);


  /*
  delay(50);
   cam.chBaudRate(1);
   delay(50);
   s.end();
   s.begin(19200);
   delay(50);
   */
  invertLED();
  cam.takePicture();
  wdt_reset();
  delay(25);
  picData.size = cam.getSize();
  pb_ostream_t stream = pb_ostream_from_buffer(wBuffer, sizeof(wBuffer));
  pb_encode(&stream, messages_picData_fields, &picData);


  sendMessage(stream.bytes_written);
  delay(10);
  invertLED();
  wdt_reset();
  cam.readData(s2);
  s2.flush();
  cam.stopPictures();
  invertLED();
cam.powerSaving(true);


}


void sendSensorData()
{
  wdt_reset();
  sensorData.temperature = tsensor.temperature();
  wdt_reset();
  sensorData.humidity = hsensor.humidity();
  wdt_reset();
  if (pumpBattLevel > 0)
  {
    sensorData.batLevel = pumpBattLevel;
    pumpBattLevel = 0;
  }
  else
    sensorData.batLevel = getBatLevel();

  getWaterLevel();


  pb_ostream_t stream = pb_ostream_from_buffer(wBuffer, sizeof(wBuffer));
  pb_encode(&stream, messages_SensorData_fields, &sensorData);


  sendMessage(stream.bytes_written);
}


void sendMessage(size_t len)
{
// Serial.print("send ");Serial.println(len, DEC);
  sendStartMessage(len);
  s2.write(wBuffer, len);
  s2.flush();
  delay(100);
  //Serial.println("endsend");
}


void sendStartMessage(size_t len)
{
  s2.write(highByte(MAGIC));
  s2.write(lowByte(MAGIC));
  s2.write(highByte(len));
  s2.write(lowByte(len));
}


void doCommand()
{
  // Serial.print(8,DEC);
  // Serial.println(command,DEC);
  switch (command)
  {
  case 0:
    sendSensorData();
    break;
  case 1:
   doPump();
    break;
  case 2:
    sendPic();
    break;
  case 3:
    doSleep();
    break;
  default:
    break;
  }


}











      

 

BoM:

Raspberry Pi B+

Arduino Pro Mini

XBee

Charge Controller

Solar Panel

12V Battery

Temp Sensor

Humidity Sensor

Water Pump

Water Level Sensor

 

LinkSprite JPEG Color - Infrared

 

 

Open Source Software Packages:

Yet Another Java Service Wrapper http://sourceforge.net/projects/yajsw/

Yet Another Cron4J http://sourceforge.net/projects/yacron4j/

vfs dropbox plugin http://sourceforge.net/projects/vfs-dbx/

 

If you have any questions, please dont hesitate to contact us.

 

Best regards,

RR

This is an update from this post http://www.element14.com/community/groups/arduino/blog/2015/04/03/iot-lights




Lights, Holiday and Electronics

 

Earlier in the year Christian and element14 sent me the kit for the IoT Xmas Lights.

http://www.element14.com/community/roadTests/1377

I was unable to enter in the challenge due to other commitments, so when I was offered the kit I promised to add something later.

 

 

Lights

My lights have finally arrived.

I looked around for LED outdoor fittings and was not happy with the options, so I went the Asian sourced bare RGB modules.

 

These are 30W RGB http://www.ebay.com/itm/261414473386

The image below was from the website.

30W_RGB.JPG

          The size is 40 x 40mm across the white area

 

The first difference was the led string is orientated 90 deg to this image, and the tags on the left side cut to seperate the three strings.

It's possible this image represents a single colour version which the seller also provides.

 

Connecting it up

I hadn't placed too much thought when I ordered these, since I could wire them in parallel and drive them as three lights.


There are issues with load balance since current will flow through the lowest resistance module.

The usual solution is to place a limiting resistor in series, but with PWM and current control this sort of defeats the purpose.


After receiving them, I noted that it should be possible to cut the right side, which then seperates each LED string.


I could then wire all three modules in series.

There are issues with this as well, since the resistance of each module will differ, the voltage across (and therefore illuminosity) may differ.


LED's have a linear current v illuminosity curve up until it hiits the knee, where more current doesn't give very much more light.

At high current or fully on, you may never see any difference, but at lower current you might.


What to do ...



Spec Sheet

As with many of these asian sources, the specifications are a little lacking.

I returned to the site to see what there was and found this.


 

TypeVoltageCurrentChipBeam AngleLM
RGB20-35v900mA30Mil120-1401200


So my modules require 900mA and 20-35v across each.

 

In the first scenario where they are in parallel, I'd need to control 2.7A.

In the second scenario I'd need to use 60v - 95v at 900mA to run them.

 

It might have helped if I looked at the Infineon shield specs (and the module specs) before ordering modules.

The shield handles 6-48v max and 700mA average with a peak of 1A ...

It suddenly struck me ... this shield was only going to be able to run one or maybe two in series ...and probably not full current and not full brightness.!


Obviously this wasn't going to work.

minions.jpg



Plan B

A Plan B is always there in case Plan A fails ...


My original intention was to fit three of these in Outdoor housings to illuminate a large concrete outdoor area we have.


Patio.JPG

The house is L shape next to this area, and the original intention was to mount one at the left side, one in the middle and another on the right side just above the bench seat.


Having large bright lights is fine, unless you are looking into them, so having three and facing downwards would provide illumination without being a nuisance.

The bulkhead lights on the walls have a cover half way down, so it washes the wall rather than being a bright object that you look directly at.


So can I change the number and/or location to still achieve the original intent.?



Will two lights work?

To provide the same area of illumination, they would need to be raised.

In order to raise them above the guttering, they need to be mounted on a J pole much like TV Aerials are.


We live in the country, and get clobbered by the North West wind.

The corner faces directly northwest, so sticking them on poles, is almost guaranteed to create noise from the wind around the pole, or the vibrations.

As our bedroom is beside one of these spots, that idea is out of the question.



Change locations

The view from this spot is uncluttered.

West_view.jpg

The lights are more decorative than necessity, so adding poles and mounting for this is not something I want to do.


A future plan is to add a structure to the area where my shadow is, and this would be suitable to add lighting to.

This doesn't exist, but was prewired for the day it does exist. (if I recall exactly where on the concrete to drill the hole ..)



Fit more Bulkheads

This idea has merit, but they currently have the mains wiring coming through the brickwork, so some redesigning to control them would be required.

Adding more bulkheads would have the same issues, but since it is not mains wiring the wire could legally be in the cavity ...


So Plan B is not going to work ...



Plan C

There should always be a Plan C in case Plan A and Plan B fails ...


I could order more shields.

This would allow flexibility in control, but could get rather complicated.

In effect I would need three controls or some form of switch in the APP to decide which lamp you are controlling.


I still wouldn't be able to have them at full brightness (900mA v 700mA)



Lower wattage modules.

The modules are available in 10W or 20W at similar low prices.

 

WattageTypeVoltageCurrentLM
10WRGB9-12v900mA900-1000
20WRGB32-35600mA1800-2000

 

As the specs show, the same current and or voltage problems exist.

 

So my orignal plan to use these with the one Infineon Shield to illuminate the concrete area is not going to work.

 

 

 

However there is a lesson in this adventure.

images.jpg

 

 

READ THE SPEC SHEETS FIRST.

 

9cf163d4695930cc5ec895624aab246b.jpg

 

Mark

Filter Blog

By date: By tag: