Show Posts
Pages: 1 2 [3] 4 5 ... 30
31  Development / Other Software Development / Re: Upload contributions in the Arduino libraries on: June 28, 2014, 05:23:11 am
You should discuss your changes on the developers form!forum/developers, clone/fork the Arduino respository and do a pull request. The better you present your changes on the forum the quicker the pull request is merged. If you check the Arduino git respository you can figure out who are the maintainers.


PS: Sorry about the bad link to the forum.
32  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 28, 2014, 04:29:48 am
As my intention is to base all my nodes on Cosa, some additional chip & functional support should be added to the Cosa eco system smiley-red
I guess the best way to make that visible is to add an issue on GitHub for each chip and/or function??

That sounds like a good idea. The issue list on github is the right place for that.

There are a few things to consider. At this stage Cosa is not a commercial product or project as Arduino. There is no license, no registration, and no release handling with maintenance. The idea is to collaborate and build an industry strength high quality fully OOP alternative to the Arduino codebase. If and when we reach critical mass the next stage will offer release and maintenance.

For now anybody may contribute by building and test, writing code, donating hardware, giving improvement suggestions, etc. Contributing code requires normal open source git handling; clone/fork and pull request. The contributed code should follow the coding standard and must have test and/or example code. Contributed code will follow the normal refactoring of Cosa. The high level of refactoring right now is also part of the current stage.

Easiest way to get new device drivers is to contribute hardware. This is important even when contributing code to the main repository. It is difficult to add code that cannot be tested. This will need a lot of convincing :-).

33  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 23, 2014, 02:03:55 pm
Some news on the latest Cosa updates:

1. TCS230 color sensor device driver

2. Arduino String class
Refactoring of the Arduino String class and support for Cosa IOStream output operator with String.

3. Removed offsetof() macro warning
Older version of AVR GCC will give warnings on usage of offsetof() macro.

4. MCP7940N Alarm interrupt handler and example sketch
The device driver supports alarm interrupts so that the MCU can power-down and wake up on a RTCC alarm. Both device alarms may be used to trigger a wake up. The device driver has been tested on Anarduino MiniWireless. A new example sketch is available.

5. Breaking the 30 KLOC barrier
The Cosa source code repository is 30+ KLOC without comments and 58+ KLOC with comments. This does not include the 150+ example sketches. Please see Ohloh for more details.

34  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 23, 2014, 04:41:21 am

Thanks for all the info and especially the links. Always great to have a look at other implementations and approaches.

My guess on the MCP79141X device was not that bad. It is basically a MCP7940N with an EEPROM (128 bytes), an ID and some security register setup sequencing. The Cosa EEPROM driver for AT24CXX has the same I2C address (0x5X) and could be used for the EEPROM part. The security sequencing will need some tweaking.

35  Development / Other Software Development / Re: Will Arduino team ever do better than this?! on: June 20, 2014, 09:14:46 am
@liudr @Jantje

I am sorry to read the latest development on this topic. This is not heading in a nice direction. Could we be a bit more constructive?

I would like to suggest the following; How about writing an "Arduino Users and Contributors Manifest" where we put together some ground rules and expectations on maintenance, refactoring and evolution of the Arduino core software. This seems to be the core issue.

What do we expect of the Arduino software and how can we achieve this? As has been pointed out a lot is community contributions but the core is a set of libraries that should also be improved. I think the Arduino Team understands this and there is a need for a community approach to the maintenance of the Arduino Library set.

The original questions raised in this topic have merit and points to some serious issues in this process. We can all do better.

I might not be the right person to suggest this as I am not directly contributing to the Arduino software. Instead I am trying to show an alternative OOP approach to programming small scale embedded i.e. my project Che Cosa Arduino or simply Cosa. Hopefully some of my ideas can be reused in this community.

36  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 19, 2014, 01:52:00 pm
Great. I just finished a board with these chips. Are the MCP7941 and MCP7942 also supported?

Do you mean MCP7941X (X=0,1,2)? They have an EEPROM. Do you have a link to the Data Sheet?

I am working on support for the devices on the Anarduino MiniWireless board. Don't have any board with those but it looks like the Cosa EEPROM driver could be adapted.

37  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 19, 2014, 11:23:31 am
Time for some news on the latest Cosa updates:

1. RFM69W/HW device driver improvements.
a. New member function for temperature reading.
b. New member function for RC oscillator calibration.

2.  CC1101 device driver improvements.
a. SPI burst read and write for send/recv.

3. Board support for Anarduino MiniWireless
Below device drivers for RTCC and Flash to support resources on MiniWireless boards.

One of the best price-performance-functionality Arduino clone board with Wireless, RTC and Flash support (in micro format).

4. New MCP7940N Real-Time Clock/Calendar (RTCC) device driver.
NB: This is ongoing work. Will be extended with alarm interrupt handler.

5. New S25FL127S 128 Mbit (16 Mbyte) SPI Flash device driver.
NB: This is ongoing work. A file/object store system will be needed for the 16 Mbyte available. A possible refactoring to the SD interface to allow FAT16 file system on Flash device.

38  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 18, 2014, 03:25:05 pm

Great analysis and fun to see that you are using the same tool as I do for Software Quality Analysis - SourceMonitor, This is a great open-source tool.

I also use the data collected from Ohloh, Here you can get a picture of the "commitment" behind Cosa also the estimation of the effort and development cost.  The Ohloh code browser is just great.

As you may see there is a difference in the KLOC count. No big deal but I guess that you have only looked at *.cpp files? If you include *.hh, *.h and *.c the total number of lines and files is somewhat larger  smiley-grin. Including all the example sketches Cosa is well over 100 KLOC (commented source code).

I use several programming techniques to reduce complexity; basically try to reduce to a "straight block" of code. I use SourceMonitor to keep a list of class/functions that should be refactored due to high complexity. Some complexity is motivated such as the switch/case blocks that give high complexity levels but are kept if the complexity per case is low. Some of them need to be refactored to an additional function level. And others refactored to classes to remove the switch all together.

Small scale embedded systems with low memory resources and moderate processor speed give a very thin line to balance complexity, performance, and memory footprint together with readability and maintainability. At the same time Cosa tries to achieve high variability and support a large number of AVR MCUs (ATtinyX5 up to ATmega2560) and boards both Arduino(TM) and clones (Anarduino, Microduino, Moteino, Pinoccio and Teensy). This is the real challenge!

With 10 years research and teaching at University followed by over 25 years in Industry I have had the opportunity to test and evaluate a number of programming paradigms, languages, and development tools and methods. This gives a slight advantage.

Thanks for your effort and putting focus on software quality.

39  Development / Other Software Development / Re: Will Arduino team ever do better than this?! on: June 16, 2014, 05:32:56 pm
Is there an Arduino (software) team?

Here is some proof of their absence. Statistics show significant drop in activity over the latest two years.!forum/developers

The major contributor(s) to the software part of Arduino have "left the building". There is no "software architect" as no money is made on software licensing, etc. This is good and bad. Some of the contributers the latest years are people giving back as they are trying to start businesses based on Arduino clones and rely on the software.

Arduino(TM) is about branding and marketing -- BOARDS. There is a lack of investment in software. This is the Achelles heel of this business enterprise as it should/must include software and software quality. Checkout the endless discussions on "clones" and "counterfeit". How often does the "Arduino Team" present something regarding improvements in software architecture?

My guess is that the Ethernet library is not maintained by the original author (any more) and it is only contributions from users that "develop" it further. The actual implementation is also on top of another library which is actually written by one of the more important maintainers and developers right now. If you check the source code you will see there is actually no author reference to Ethernet.h and Ethernet.cpp. The Dhcp class has the following info:
// DHCP Library v0.3 - April 25, 2009
// Author: Jordan Terrell -
If you check "blame" in git you can actually see the changes to the Ethernet library over the years.

40  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 15, 2014, 02:10:55 pm
Hi, first off, thumbs up for all the quality work put into Cosa, this is really impressive!
Thanks for your kind words. I hope you find the going development inspiring.
I wonder if there are some guidelines for people who would want to contribute to the project (e.g. preferred tools and settings for these tools), and possibly some tips about it. Also, I am not completely clear about the way new source files should be organized.
There are no required tools other than the Arduino IDE for building, upload and testing. I use GNU Emacs and basic Linux tools. Standard C/C++ Emacs mode setting (2 character indent). The only thing extra in my .emacs settings is:
(setq auto-mode-alist (cons '("\\.\\(pde\\|ino\\)$" . c++-mode) auto-mode-alist))
It is possible to contribute to Cosa as any other Arduino software; as libraries or simply source code. The Cosa repository is not open but you can still clone/fork and do pull requests. Normal git style.

I should add a list of contributed Cosa libraries with links to their repositories on the Cosa github README page. Will put that on the to-do-list.
I am currently developing a few classes to manage MAX7219/7221 IC (LED display drivers with a serial interface, like SPI).
I have got inspiration from Cosa LCD and could already reach some success (for the moment, I published my work on; it integrates well with Cosa IOStream.
Fun! It is really interesting to see that you have been able to produce a driver with the limited documentation available. And reuse a fair amount of code.

That driver was actually something I have on the summer to-do-list. Waiting for an LCD board from ebay ;-). I was planning to add MAX7219/7221 simply as yet another implementation of the Cosa LCD interface. Looks like you have added an extra class level instead of using LCD::Driver as the base class. The LCD::IO adapters can be used directly. That would make it much simpler, less code, and follows the Cosa design style with an abstract interface and adapter pattern.

Your font handling was an interesting approach. I hadn't come so far to considering this issue.
41  Development / Other Software Development / Re: Remote procedure calls on: June 15, 2014, 10:43:07 am

Decent RPC is much more than a serialization protocol. Most middleware tools include an IDL (Interface Description Language), a compiler and a run-time library. The high end of these are systems such as OMG CORBA and DDS.

Typical RPC support systems look like this;

1. Run-time library with serialization functions, parser and dispatcher.
2. Interface Description Language with compiler to generate Proxy and Adapter functions.
3. The Proxy functions (or class) give the full illusion of local function but will perform the serialization of the call and the deserialization of return value (if any). The Proxy is the client/caller side support.
4. The Adapter functions (or class) perform the deserialization of the call request, call the implementation, and the serialization of the return value (if any). The Adapter is the server size support.

IDL has been around since the late 80'ies when introduced with XDR/RPC by Sun for implementing for instance NFS (Network File System). XDR (eXternal Data Representation) is the name of the serialization method. Microsoft has used IDL for a number of things (DCOM, etc). In Java there is RMI (Remote Method Invocation) which has its own serialization method but can also use IIOP (as defined by CORBA). Should not forget ASN.1 and SNMP which also addresses the issue of interface/data description.

Most of the above serialization methods are binary and have to handle that data may be represented differently in memory on the client and server (e.g. endian). With a textual representation this is avoided at the price of more processing and larger messages (on average).

Other popular textual serialization methods are XML, YAML and Json. On the binary side the Google ProtocolBuffers is maybe the more popular to handle large data sets.

The bottom line: Having a textual format and HTTP is a great way to start and provides a command line style access. Scaling up becomes very difficult and the footprint and processing needed grows fast. From a programmers perspective the RPC should simply be a set of functions and the necessary serialization hidden. Having to implement RPC function calls as HTTP request generation is work that can be automated to avoid errors in parameter printing and parsing (e.g. escape characters in strings).


1. Middleware,
2. IDL,
4. DDS,
5. RMI,
6. ASN.1,
7. REST,
42  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 12, 2014, 01:42:34 pm
Some news on the latest Cosa updates:

1. Updated RFM69W/HW device driver

2. Support for LCD ST7920
First iteration of support for Graphical and Character based LCD ST7920. Character based (16x4) only in this release.

3. Support for LowPowerLab Moteino
Board definition:
Arduino IDE:
The Wireless example sketches work with Moteino and RFM69.

4. Unsigned integer counter wrap around handling
Improved support for timer (Watchdog/RTC::since) wrap around handling.
Usage pattern:
// Capture start time
static const uint32_t TIMEOUT = ....;
uint32_t start = RTC::millis();
// Check elapsed time
if (RTC::since(start) < TIMEOUT) {
Example usage:

5. New Wireless example sketches; Ping-Pong
Demonstrate simple retransmission of messages. CosaWirelessPing will send a sequence number to CosaWirelessPong which increments the received number before sending it back. The message is retransmitted if a reply is not received within a time-limit.
CosaWirelessPing: started


43  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 10, 2014, 02:51:27 am
I haven't decided yet on the best approach. The MQTT-SN protocol is also still a good solution for the wireless nodes, as it makes the gateway very easy: such a forwarding gateway is fully described - protocol and message encapsulation/decapsulation - in the MQTT-SN specification document.

Sensor nodes and gateway would both be based on AVR and Cosa.
I could use simple structs to compose messages and send them using one of the radio components available in Cosa.
For periodic sensor scans on the nodes, the Activity object seems very well suited.
Most sensors are already implemented in Cosa, so I get al lot for 'free' this way.

I think the overall architecture sounds just right. I would only tweak it a bit; 1) to allow low power wireless sensor nodes it is more efficient to push data instead of pull (scan), 2) there is a need for a plug-in wireless protocol so that it is really easy to administrate, 3) there is also a need for a management protocol for remote sensor configuration (and software update). These are some of the really interesting challenges in wireless sensor networks protocol design and implementation.

Implementing MQTT-SN on top of the Cosa Wireless interface seems like an interesting project and something I might consider.
Right now I am adding support for Low Power Lab Moteino with RFM69/H and playing around with ST7920 LCD.

44  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 09, 2014, 05:42:41 pm
I'm trying to figure out how to use LCD::SPI3W (or LCD::Serial3W) without connecting SCE to the Arduino. The reason is that I need the pins for other IO.
Can this be done in any simple way?

Yes, simply copy the IO adapter to your sketch and remove the SCE handling. This assumes that the LCD device does not require the SCE signal to latch data, etc, and it can be tied low.

45  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 09, 2014, 05:15:15 pm

Sounds like a nice project. Most of the components are available though there is still some glue missing.
Should I use Rete or Ciao for sending data from the wireless nodes to the central node?
Right now these two components do not contribute that much. Rete is more of a framework for wireless nodes inspired by Panstamp (, while Ciao is a compact, self-descriptive, data serialization method. If both the wireless nodes and central node are AVR based the simplest approach is to send binary data (e.g. struct) and do the MIB modeling on the central node. More complex and generalized solutions could use the Protocol Buffer or Ciao support together with encryption for transmission. And UML modeling to code generate the MIB map (e.g. Cosa Registry). It all depends on the scale of the project and the product standardization one wants to achieve.

could I use the Registry to translate the remote sensors to MQTT objects?
Yes, this is actually one of the use-cases for the Cosa Registry. For MQTT it would be more natural to use string names instead of index sequences (ala SNMP). This is one of those items on the to-do-list.

Pages: 1 2 [3] 4 5 ... 30