An archive of community.esquilo.io as of Saturday January 26, 2019.

EOS 0.3beta1 Release

Scott_Shumate

We're happy to announce the release of EOS 0.3beta1 for Esquilo. This release contains a number of new features and bug fixes including 1-Wire, NeoPixels, Cryptography, and Library Sync to name a few. The complete release notes and the download link may be found here:

http://www.esquilo.io/docs/#!eos-releases

After downloading the image file, follow the update instructions here:

http://www.esquilo.io/docs/#!eos-update

The update procedure is no harder than copying a file to a USB flash drive.

This is a beta release so it has not undergone the same level of testing as a general release so it is possible to run into problems. Please report any problems or ask questions here on the Esquilo community site.

Thanks!

JefferyS

That's great, One question, since we are using the Uart for the 1-Wire how do I need to hook it up to a DS18B20 temp sensor. The Uart has TX and RX lines so not sure what to do there. I plan to use power from the board so I'm not trying to get power from the Uart.

From the Datasheet is can use from 3.0 - 5.0 volts, should I use the 3.3v supply from the board. I may have missed it but I didn't see anything in the hardware docs that talked about connecting to the Uart.

I look forward to trying this.

Thanks,

Jeffery

Scott_Shumate

For a powered DS18B20, here's the required connections:

  • DS18B20 VDD to Esquilo 3.3V
  • DS18B20 GND to Esquilo GND
  • DS18B20 DQ to Esquilo UART TX
  • Esquilo UART RX to Esquilo UART TX
  • 4.7Kohm resistor from Esquilo UART TX to Esquilo 3.3V
gwittie

I ran into an odd issue that I'm not I want to try to re-create. I just upgraded to tis version and was trying out various demo nut executables that I have. I was moving the mouse pointer from my project directory up to the lib directory and push the mouse button in the left side of the directory listing which collapsed the project list (normal for this sfw), but I accidentally dragged the mouse up to the lib section which deleted the entire project directory. It was not moved to the lib directory (I looked at all folders and subfolders). It was just deleted. I had to pull all of the files back from my Mac to the SD card so I am back in operation. I am glad I did not have any important files that were not recoverable.

gwittie

Sorry for the typos but after the project directory disappeared, I did the directory refresh numerous times. I powered the board down and up a few times, but nothing brought back the project folder and files.

cswiger

Really cool!! Has my 2 strings of 144 neopixels working nicely sunglasses
This'll likely be part of my Halloween costume.

Much better than my attempt to use a 3rd party library with SPI bus, which worked with issues (like, completely locking up).

Next, the ds18b20.

Scott_Shumate

That's strange. A drag should move the directory and not delete it. We'll try to reproduce it here.

cswiger

ds18b20 tested ok here - took me a while before realizing there is a Onewire class (extends Flexwire) in the lib/busses/ folder to include - then the example works.

Running nut 'sd:/test_ds18b20.nut'.
temp = 24.75

Did some looking but don't see anyway squirrel can be a web client? To publish to an mqtt topic using an url like an esp8266? Or is the better method to have a service query the esquilo via erpc?

Scott_Shumate

Great! I'm glad you got the DS18B20 working.

For web client functionality, use the HTTPC class. You can make web services requests, download files, or do whatever. I'm not familiar with the URL-based MQTT service you're referring to but if it's straight HTTP, then the HTTPC class should be able to do it.

Here's an HTTPC example that sends a temperature to the Dweet service:

function sendDweet()
{
    local temperature = ds18b20.readT();
    local https;
    
    try {
        https = HTTPC("dweet.io", 443);
        https.get("/dweet/for/wild-battles?temperature=" + temperature);
	    print("dweet sent\n");
        local s = https.readstr(1000);
        print(s);
    }
    catch (err) {
        print(err+"\n");
        if (https)
        	print("code: " + https.code() + "\n");
    }
}
cswiger

Thanks Scott!! Worked marvelous, didn't know there was an HTTPC class.
It's a well kept secret - don't see it in any squirrel or esquilo docs smile


require("HTTPC");

local https = HTTPC("data.sparkfun.com", 443);

local temperature = "22.3";

https.get("/input/xRXK9WzRwVHp7yalpOpD?private_key=xxxxxxxxxxxxxxxxxxxx&temp=" + temperature);
local s = https.readstr(1000);
print(s);


1 success

{
"temp": "22.3",
"timestamp": "2015-08-10T17:11:24.490Z"
},

JefferyS

Hi, I'm now getting a temp but if I run it twice I loose connection to the Esquilo. Been loosing connectivity a lot when trying to get this to work. I have to power it off then on to get it to work again.

Any Ideas on what I might be doing wrong to make this happen? I'm just getting the temp and displaying it on a LCD screen.

Also using 53% of memory.

Thanks,

Jeffery

JefferyS

Thanks Scott for the connection info.

Scott_Shumate

It's likely running low on memory. SSL is a memory pig so you have to be really careful with your memory usage. SSL uses a lot of memory for the certificate exchange and cryptography. To establish an SSL connection, you'll need in the neighborhood of 30% memory free. The black line in the IDE memory bar shows the memory high water mark. You'll want to keep that below 80% or so to give the system some breathing space. If you are sitting at 50-60% before making the SSL connection, then you're probably on the edge.

To free up memory, turn off anything you're not using like USB console, FTP, nest connection, etc. Also, using the new require() function in EOS 0.3 helps a lot to only load the libraries you are actively using. If you use require(), then turn off all Squirrel libraries in the IDE menu. Also, non-SSL HTTP uses very little memory if you aren't concerned with security.

We're working on reducing the SSL memory usage but you'll have to use one of the above techniques until we get there.

JefferyS

Thanks Scott for replying so quickly.

I'm not using SSL that I know of, haven't started working on the web interface yet.

Scott_Shumate

Are you able to post your code?

JefferyS

Sure.

dofile("sd:/HighTemperatureSensor/LcdDisplay.nut");
dofile("sd:/Lib/Buses/OneWire/OneWire.nut");
dofile("sd:/Lib/Sensors/DS18B20/DS18B20.nut");

/* Create a _onewire instance on UART1 */
onewire <- Onewire(1);

// /* Search for the DS18B20 on the bus */
rom <- onewire.searchRomFamily(0x28);
if (!rom)
throw("DS18B20 not found");

// Create the DS18B20 instance
ds18b20 <- DS18B20(onewire, rom);

// Read the current temperature
temp <- ds18b20.readT();

temp <- ((temp * 9) / 5) + 32;

// Initalize Button
local button1 = GPIO(3);

// Configure pin as a digital input
button1.input();

// Initialize the 16x2 serial LCD using UART0 and PWM0 channels 0 - 2
lcd<-Lcd(20, 4 UART(0));
lcd.on();

lcd.setCursor(0,0);

lcd.print("Address = " + rom + "\n");
lcd.print("Temp = " + temp + "\n");

steveb48

I may have had the same experience as gwittle. The entire contents of my SD card disappeared. I tired removing / reinserting and cycling power and no joy. I also pulled the card out and inserted it into my Mac and it was indeed all gone. This was not with the beta. I can't confirm that the cause was the same but the result was.

Steve

cswiger

Recently had the 'run and lose connection' issue - solution was to uncheck some of the squirrel libraries (had added 'serial' when searching for the 'onewire' function) - I also have PWM, Quadrature, Crypto and Flexwire so serial put it over memory it appears.

This has been running all night logging data points:


require("HTTPC");
dofile("sd:/onewire.nut");
dofile("sd:/ds18b20.nut");

// local https = HTTPC("data.sparkfun.com", 443);

onewire <- Onewire(0);
rom <- onewire.searchRomFamily(0x28);
if (!rom)
throw("DS18B20 not found");

/* Create the DS18B20 instance */
ds18b20 <- DS18B20(onewire,rom);

/* Read the current temperature */
temp <- ds18b20.readT();

while (true) {
/* Read the current temperature */
temp = ds18b20.readT();
print("temp = " + temp + "\n");
try {
local https = HTTPC("data.sparkfun.com", 443);
https.get("/input/xRXK9WzRwVHp7yalpOpD.json?private_key=xxxxxxxxxxxxxxxxxxxx&temp=" + temp);
local s = https.readstr(1000);
print(s);
} catch(error) {
print("error: " + error);
}
delay(300000);
}