Sensorbase datalogger is an open data repository run by the Center for Embedded Networked Sensing at UCLA. It’s a database of sensor databases. You can upload datasets to it, and you can browse other datasets as well. If you’ve never set up a database before but are interested in logging sensor data, it’s a good tool to get started. If you know what you’re doing already and you need to log a lot of sensor data, or compare it to similar work from others, it’s a convenient tool.

Since I like working with sensors and microcontrollers connected directly to the Internet, I thought it would be useful to be able to put data directly into Sensorbase from sensors connected to a microcontroller, without a personal computer in between.

Continue reading “Sensorbase datalogger”

Web Scraping using a Microcontroller

This program connects a Wiring or Arduino module to the internet through a Lantronix serial-to-ethernet converter (Xport, WiPort, or Micro). The microcontroller makes a TCP connection to a web server first. Once it’s got a connection, it sends an HTTP request for a web page. When the web page comes back, it parses the page for < and > symbols, and takes the string between them. Then it converts the string to an integer. It assumes the string is made only of numeric ASCII characters (0 – 9).

This program couldn’t parse an entire web page very easily, so it’s best used in conjunction with a web scraper PHP script like this one, which reads the AIRNow site and extracts the Air Quality Index into a single string like this:

< AQI: 54>

This program was written to make an air quality index meter out of an analog voltmeter.

The electrical connections to the microcontroller are as follows:

  • disconnected LED: Arduino digital I/O 6
  • connected LED: Arduino digital I/O 7
  • connecting LED: Arduino digital I/O 8
  • requesting LED: Arduino digital I/O 9
  • Lantronix module reset: Arduino digital I/O 10
  • Voltmeter: Arduino digital I/O 11. The voltmeter is controlled by using pulse width modulation (analogWrite() command on the Arduino).

The web scraper is written in PHP. Its code follows below the Arduino code.

Technorati Tags: ,

Continue reading “Web Scraping using a Microcontroller”

Sending UDP Datagrams to and from a Cobox, Xport, or WiPort

The Cobox Micro can send and receive UDP packets. I haven’t written examples yet. Following are just my notes, from discussions on the Lantronix Xport Yahoo mailing list, and from experimentation.

To send directed UDP packets, you have to put set the connectMode appropriately. Bits 2 and 3 of the ConnectMode register are set to 1 to enable directed UDP. Setting the ConnectMode to 0xCC (hex) will set the Cobox to accept any incoming UDP packets and allow you send UDP packets to the address and port number you set for the remote IP address. Once you’ve set the ConnectMode to 0xCC, set the Datagram Type to 01. With these settings, your cobox will only send to the remote IP specified in your configuration.

It is possible to change the destination address on the fly. It’s undocumented, but the Lantronix folks on the list have been helpful in figuring it out. First, you have to set the ConnectMode to CC and the Datagram type to 00. In this configuration, you have to compose your own outgoing datagrams, as follows:
Continue reading “Sending UDP Datagrams to and from a Cobox, Xport, or WiPort”

Lantronix Device Connection with serial feedback

This program waits for the Lantronix device to give an acknowledgment of a net connection before it starts to send data. The Lantronix Device has to have its connect mode set to verbose, so that it will send ASCII N when not connected, ASCII D when disconnecting, and ASCII C when a connection is made.

Technorati Tags: ,

Continue reading “Lantronix Device Connection with serial feedback”