Show Posts
Pages: [1] 2
1  Development / Other Software Development / Re: (Library inception) Including a library inside a library! on: November 17, 2013, 11:56:00 am
Just for future reference:
http://provideyourown.com/2011/advanced-arduino-including-multiple-libraries/
2  Using Arduino / Networking, Protocols, and Devices / Re: Arduino serial messaging protocol on: November 03, 2013, 05:22:50 pm
The delimiters are the non-hex characters: T, N, I, P, Q

Command message T01N00I12PFFQ21 : "set motor speed of 'Arduino zero' to +100%:
  • T01: Type 01: Command message
  • N00: Number 00: Node number 00 (is the destination)
  • I12: CommandID 12: Set motor speed
  • PFF: Payload FF: full speed (range: 0 (reverse) -> 80 (stopped) -> FF (forward))
  • Q21: Quality 21: parity byte is 21

Data message T12N00I10P08Q0A : "temperature of 'Arduino zero' is 8 degrees"
  • T12: Type 12: Data message (1 byte payload)
  • N00: Number 00: Node number 00 (is the source)
  • I10: SensorID 10: Temperature
  • P08: Payload 08: 8 degrees
  • Q0A: Quality 0A: parity byte is 0A
3  Using Arduino / Networking, Protocols, and Devices / Re: Arduino serial messaging protocol on: November 03, 2013, 07:39:16 am
@oric_dan: thanks for the remarks, I will add some extra info to the Github page.

About: "the human readable ASCII messages"

We actually send the ASCII values of hex characters between 0 and F (zero and F) (that implies being very inefficient, 240 unused values)
For example:
The packet: "T01N00I12PffQ21"

Would be 15 bytes on the wire (ASCII : HEX)
T: 54
0: 30
1:  31
N: 4E
0: 30
...

The downside:
  • efficiency.
  • it is quite simplistic

The upside is:
  • Easy to parse (easy to see where a message starts and ends)
  • Easy to read (mainly because of the delimiters)
  • No problems with magic number or magic sequences for message headers
4  Using Arduino / Networking, Protocols, and Devices / Re: Arduino serial messaging protocol on: November 03, 2013, 07:23:27 am
I have checked Firmata, but as far as I understand its main goal is to replicate the low-level Arduino API on the PC side.
From the Firmata site: The aim is to allow people to completely control the Arduino from software on the host computer
For example:
  • send the result of "AnalogRead" over the serial port when the PC requests this value.
  • set the PWM value for the analog output pins

Since this would really lower the maximum sampling rate, this approach does not fit all possible applications.

Our goal is to implement "high level messages" to share information that might be based on the data of multiple sensors. (or multiple devices in a wireless sensor network)
For example:
  • This is the current temperature
  • Room x is currently not occupied
  • Remote controlled car has entered room x
5  Using Arduino / Networking, Protocols, and Devices / Re: problem with sensornet of maniacbug, anyone can help me !!!! on: October 25, 2013, 05:02:33 am
The first error indicates that the compiler can't find the library in your path.
Did you place the library in the 'libraries' folder?
6  Using Arduino / Programming Questions / Automated Arduino coding style & error checking? on: October 24, 2013, 09:03:09 am
I have been wondering for a while why there are no tools to check Arduino code for common mistakes and errors.

Some ideas:

Coding style:
Arduino traps & tips:
http://www.gammon.com.au/forum/?id=12153
http://forum.arduino.cc//index.php?topic=190272.0

Maybe it could be interesting to start from cpplint (Google c++ coding style checker) and make a style checking tool for Arduino?
https://pypi.python.org/pypi/cpplint

Or maybe it could be interesting to see what Arduino can learn/use from MISRA-C?
http://www.embedded.com/electronics-blogs/beginner-s-corner/4023981/Introduction-to-MISRA-C
http://en.wikipedia.org/wiki/MISRA_C

Does anyone know about AVR Libc tools that offer similar features?
http://www.nongnu.org/avr-libc/
7  Using Arduino / Networking, Protocols, and Devices / Arduino serial messaging protocol on: October 24, 2013, 08:38:46 am
Scratching your own itch...
As a university lecturer, I was annoyed by the fact that, every year, all my students were implementing their own very simple protocols to connect Arduino & pc applications.
As a results it was hard to reuse their code and most of the time it is hard to interconnect applications from different teams.

Why this can be useful
This library was developed to allow multiple teams of students to work together on Arduino/embedded Linux projects
Some teams working on the embedded Arduino side, other teams working on Python applications running on the Raspberry PI.
The goal is to have a standardised "communication protocol" to ensure interoperability between software/hardware blocks.
Hopefully this will allow future student to start from the current code base to develop their projects.

The concept
We are developing a library  to exchange short messages (sensordata, commands) between an Arduino and software applications running on a PC. (Linux, embedded Linux, Windows, OS X)

Both sides are able send and receive a range of "standardised" messages over the serial port. All communication is done by sending short human readable ASCII messages. We define several standard command and data packet IDs to provide interoperability between different applications.

The protocol was designed to be relatively easy to comprehend and process by both human and computer.
  • A standardised message structure (more info below)
  • All fields in a message are separated by delimiters (just a letter indicating what the next field will be)
  • All communication is in HEX ASCII values (to allow human and computer to understand the packets)
  • Invalid messages are detected by calculating the parity (XOR all serial bytes)

The Message Types
The library support seven basic packet types.
  • "Command": start motor, blink LED, go to sleep mode,...
  • "Command Reply": e.g. motor started, LED blinking, going to sleep mode now,...
  • "8-bit Data": (standard Arduino Byte type): e.g. temperature is 25 C, distance is 50 cm, humidity is 56%
  • "16-bit Data": (standard Arduino int type): e.g. temperature is -25 C, distance is 310 cm, time is 16200 seconds, ...
  • "Data array": send multiple sensor measurements in one burst (useful when sampling very rapidly)
  • "Data request": e.g. send me the temperature, distance, humidity, ...
  • "Data array request": e.g. send me a burst of measurements

Github page: https://github.com/jeroendoggen/Arduino-serial-messaging
8  Topics / Education and Teaching / Re: Arduino Cheat Sheet: Poster on: June 24, 2013, 05:43:03 pm
Thanks for the remarks.
The poster has been updated.
9  Topics / Education and Teaching / Arduino Cheat Sheet: Poster on: June 24, 2013, 01:58:09 pm
I would like to share my "Arduino Cheat Sheet" poster.
This poster gives an overview of the most important Arduino Language elements.

.pdf version and LaTeX source available at: http://jeroendoggen.github.io/Arduino-cheat-sheet/
Feel free to adapt the poster to your own needs.

Direct downloads:

The poster is based on:
10  Using Arduino / Sensors / Re: Library for Distance Sensors on: April 01, 2013, 03:53:07 pm
The version with the LUT is AVR specific, but the generic library that calculates 1/D should work just fine on the Due.
(http://code.google.com/p/arduino-distance-sensor-library/)
11  Development / Other Software Development / Re: RTuinOS: A Real Time Operating System (RTOS) for Arduino 1.0.1 on: January 01, 2013, 06:53:38 pm
This project looks really impressive and is very cleanly written and documented.

I have several questions:
  • Did you start from scratch or is this code based on an other RTOS implementation?
  • How does RTuinOS compare to protothreads? (http://code.google.com/p/protothread/)
  • How does RTuinOS compare to DuinOS? (http://code.google.com/p/duinos/)
  • What was the main goal for developing this project? (since other similar implementations exist)
  • Is/was this part of a university thesis or research project?
  • You have 10 example applications in your library, have they been tested in real world applications or are they just a proof of concept at the moment?

I think that this project deserves more attention.
Maybe you can move your project to a public Github repository?
That would make it a lot easier for people to find.
12  Development / Other Software Development / Arduino TestSuite: Automated Arduino Unit Tests on: December 31, 2012, 10:58:05 am
The last days, I have been working on my first Python program named: "arduino_testsuite"

GitHub project page: http://jeroendoggen.github.com/Arduino-TestSuite
Page in the Python Package Index: http://pypi.python.org/pypi/arduino_testsuite

This program allows automated running of several Arduino unit tests. The testing process is started on the PC but the tests run on the actual Arduino hardware. One set of unit tests is typically used to test one Arduino library.

Program flow:
The following steps are performed for each set of unit tests:
  • Read the config file to find out which tests to run
    • The script compiles and uploads an Arduino sketch that contains the unit testing code.
    • The unit tests are run on the Arduino board.
    • The results of the test are printed over the serial port and analyzed by the Python script.
  • The script starts the next test, repeating the above steps for all test that are requested in the configuration file.
  • The script prints a summary showing an overview of all the failed/passed tests in the complete testsuite.

Dependencies:

Why is this useful:

Typical test output:

Code:
jeroen@computer:~/tests$ python -m arduino_testsuite
=============================================================
Planned tests:
 1. examples/floatingPin
 2. examples/inInterval
 3. examples/simpleTest
 4. examples/buildErrorTest
 5. examples/nonExistingFolder
 6. examples/slowTest
 7. examples/verySlowTest
==============================
.... output normally continues for a while ... link to full log below.

Full log in: https://raw.github.com/jeroendoggen/Arduino-TestSuite/master/resources/example.log (number of characters per post is limited)

Comments are more than welcome. (remember, this is my first Python program...)
 
13  Using Arduino / Sensors / Re: Library for the Sharp GP2Y0A21YK IR Distance Sensor on: May 21, 2012, 03:26:14 pm
Update: The current version provides a unified interface for four sensors:

SRF04 & SRF05 Ultrasonic Ranger
Sharp GP2Y0A21YK IR Distance sensor
Sharp GP2Y0A41SK IR Distance sensor

This version no longer uses a LUT, but calculates the transfer functions of 1/D at runtime (they are nearly linear).

Inheritance diagram:
http://arduino-distance-sensor-library.googlecode.com/hg/Documentation/InheritanceDiagram-DistanceSensor_v2.png
14  Using Arduino / Sensors / Re: Library for the Sharp GP2Y0A21YK IR Distance Sensor on: January 23, 2012, 09:05:08 am
I have a semi-decent version of the generic DistanceSensor class.
(warning: the code compiles but is not yet tested using actual sensors)

Top level class: DistanceSensor
Level1 classes: hardware type/group specific code: class for analog sensors and class for timing based/acoustic sensors (AccousticDistanceSensor, AnalogDistanceSensor)
Level2 classes: sensor type specific code:  (DistanceSRF04, DistanceGP2Y0A21YK)

Now adding other sensors with different LUTs or timing options should be straightforward: just add a new "level2" class.

Source: http://code.google.com/p/arduino-distance-sensor-library/

Doxygen documentation: http://arduino-distance-sensor-library.googlecode.com/hg/Documentation/latex/refman.pdf

Inheritance diagram:
15  Using Arduino / Sensors / Re: Library for the Sharp GP2Y0A21YK IR Distance Sensor on: January 22, 2012, 04:05:41 pm
direct link to the spreadsheet: http://gp2y0a21yk-library.googlecode.com/hg/Calculations/CalculationsDistanceSensorTransferfunctionLUT.xls
(works fine for me using LibreOffice)

The option for runtime calibration is planned for "Version 0.6: Compare different sensors, calculate replacement LUT (at runtime) based on calibration points" (copy past from header file :-) )

I currently have 5 sensors that are tied together sitting on my desk.
My plan is to do this runtime testing/calibration using 5 sensors to check for inter-sensor differences.
I haven't done the experiment yet because I needed some extra wires + breadboard, to connect them all at the same time.

It think the best approach would be conditional compilation with 3 options:
  • speed optimized: my current code
  • code size optimed: the multimap version using your approach
  • default: 4(?) bit LUT combined with multimap 

A more (too?) complex solution might be:
  • a standard generic LUT: 8 bits
  • + a 'differential' LUT for each individual sensor: using calibrated values: 4 bits

Lots of possibilities...

Pages: [1] 2