Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 31
61  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.

62  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.

63  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.

64  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.
65  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,
66  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


67  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.

68  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.

69  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.

70  International / Scandinavia / Re: Synth(MIDI)-styrda ljuseffekter, påbörjat projekt, uppskattar feedback on: June 06, 2014, 05:53:40 am
Hum, kul projekt! Verkar enklare att bygga om tex eller 1M 30 Pixels WS2812B RGB band. Lite mer programmering men det är ju den roliga delen.

Skulle rekommendera att göra en tabelldriven lösning. Kanske till och med en interpretator för ett byte-orienterat språk. Då skulle man kunna skicka LED styrprogram över MIDI.

71  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 06, 2014, 05:09:10 am
Some news on the latest Cosa updates:

1. Bug fix
a. NRF24L01 auto acknowledgement
The Cosa NRF24L01 Wireless device driver had a problem with leaving auto acknowledgement pipe address enabled after send. This allowed illegal match of incoming message.
b. Removed compiler warnings
Compiler warnings on unused variables, empty while blocks and PROGMEM usage (older tool chain) have been removed.
c. bit_mask_write() name error

2. New Wireless example sketch: CosaWirelessRelay
Simple message relay example sketch. The example sketch should be used together with two additional nodes running CosaWirelessSender resp. CosaWirelessReceiver. The sender will send messages to node 1..3 and broadcast. The relay (node 3) will retransmit the message to node 1 (receiver).

3. Soft Shift Register Parallel Output template class (Soft::SRPO<N>, 74HC164)
A direct pin implementation of the SRPO<N> template class and new example sketch.

4. Soft Shift Register Parallel Input template class (Soft::SRPI<N>, 74HC165)
Input pin expander using 74HC165.
                      74HC165/1   (VCC)
                       +----U----+    |
 (D5/PLD)---+--------1-|/PL   VCC|-16-+
 (D4/SCL)-+-)--------2-|CP    /CE|-15-----------(GND)
 (Q4)-----)-)--------3-|D4     D3|-14------------(Q3)
 (Q5)-----)-)--------4-|D5     D2|-13------------(Q2)
 (Q6)-----)-)--------5-|D6     D1|-12------------(Q1)
 (Q7)-----)-)--------6-|D7     D0|-11------------(Q0)
          | |        7-|/Q7    DS|-10-----------------+
          | |      +-8-|GND    Q7|--9--------(SDA/D3) |
          | |      |   +---------+                    |
          | |      |      0.1uF                       |
          | |    (GND)-----||-------(VCC)             |
          | |                         |               |
          | |           74HC165/2     |               |
          | |          +----U----+    |               |
          | +--------1-|/PL   VCC|-16-+               |
          +----------2-|CP    /CE|-15-----------(GND) |
 (Q12)---------------3-|D4     D3|-14-----------(Q11) |
 (Q13)---------------4-|D5     D2|-13-----------(Q10) |
 (Q14)---------------5-|D6     D1|-12------------(Q9) |
 (Q15)---------------6-|D7     D0|-11------------(Q8) |
                     7-|/Q7    DS|-10                 |
                   +-8-|GND    Q7|--9-----------------+
                   |   +---------+
                   |      0.1uF

5. LCD adapter (SR3W/SR3WSPI/SR4W) with 74HC164
New circuit descriptions for LCD/HD44780 (aka 1602) adapters using 74HC164. Both cheap and fast (<$0.1 and <50 us per LCD operation). Uses only 3-4 pins.

6. New Blink example sketch
Blink RGB LED according to temperature reading from DS18B20; Short GREEN blink every 2 seconds if within 25-30 C. Blink BLUE if lower and RED if higher. Also demonstrates power down (<10 uA @ 3V3, ATtinyX4 @ 8 Mhz).

For more details see the github commit log;

72  Using Arduino / Displays / Re: Library Size on: June 01, 2014, 02:27:02 pm
Hum, I guess you did not read the info on the link. The answers are yes reduction by 10-20% or even more and yes there is a Mac OSX version. More details on the link. Cheers!
73  Using Arduino / Displays / Re: Library Size on: June 01, 2014, 01:04:21 pm
You could try the new AVR tool chain with GCC 4.8.1;!msg/developers/21G5w2HbUOg/bJtG94vEEhkJ

74  Development / Other Software Development / Re: Upload contributions in the Arduino libraries on: June 01, 2014, 09:34:03 am
Try posting your change here.!forum/developers
You should clone, do the change and issue a pull request. Follow that and I think you will get better attention. Your change is very small so that should not be a problem.  Cheers!
75  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: May 31, 2014, 06:03:20 pm
Check the CosaWirelessButton and the CosaWirelessReceiver example sketches. I think that will answer all your questions.

What might be confusing is that "outs.print(msg->payload, PAYLOAD_MAX);" prints the contents of the payload in hexadecimal notation. The payload does not contain the blanks. They are part of the formating.

Also the Wireless send/recv handle any data reference (void*) that is less or equal to the max payload size. The application can pass a string, struct, etc. Many of the example sketches pass struct's with binary data. The payload is not converted to and from strings (textual representation).

Pages: 1 ... 3 4 [5] 6 7 ... 31