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.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Wireless/Driver/RFM69.hh#L182

2.  CC1101 device driver improvements.
a. SPI burst read and write for send/recv.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Wireless/Driver/CC1101.cpp

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). http://www.anarduino.com/miniwireless/

4. New MCP7940N Real-Time Clock/Calendar (RTCC) device driver.
http://ww1.microchip.com/downloads/en/DeviceDoc/20005010F.pdf
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/TWI/Driver/MCP7940N.hh
NB: This is ongoing work. Will be extended with alarm interrupt handler.

5. New S25FL127S 128 Mbit (16 Mbyte) SPI Flash device driver.
http://www.spansion.com/Support/Datasheets/S25FL127S_00.pdf
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/SPI/Driver/S25FL127S.hh
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.

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

Great analysis and fun to see that you are using the same tool as I do for Software Quality Analysis - SourceMonitor, http://www.campwoodsw.com/sourcemonitor.html. This is a great open-source tool.

I also use the data collected from Ohloh, https://www.ohloh.net/p/cosa. 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. http://code.ohloh.net/file?fid=mVgoe27AUP5UxXPqMApmnvc6trQ&cid=a76NbRQjUKM&s=&fp=499294&projSelected=true#L0

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.

Cheers!
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.
https://github.com/arduino/Arduino/graphs/contributors
https://groups.google.com/a/arduino.cc/forum/#!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:
Code:
// DHCP Library v0.3 - April 25, 2009
// Author: Jordan Terrell - blog.jordanterrell.com
If you check "blame" in git you can actually see the changes to the Ethernet library over the years.

Cheers!
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!
@jfpoilpret
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:
Code:
(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 https://github.com/jfpoilpret/arduino-projects/tree/master/CosaMax7219); 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.
 
Cheers!
65  Development / Other Software Development / Re: Remote procedure calls on: June 15, 2014, 10:43:07 am
@liudr

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

Cheers!

Ref.
1. Middleware, http://en.wikipedia.org/wiki/Middleware
2. IDL, http://en.wikipedia.org/wiki/Interface_description_language
3. CORBA, http://en.wikipedia.org/wiki/CORBA
4. DDS, http://en.wikipedia.org/wiki/Data_Distribution_Service
5. RMI, http://en.wikipedia.org/wiki/Java_remote_method_invocation
6. ASN.1, http://en.wikipedia.org/wiki/ASN.1
7. REST, http://en.wikipedia.org/wiki/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
Interface: https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Wireless/Driver/RFM69.hh

2. Support for LCD ST7920
First iteration of support for Graphical and Character based LCD ST7920. Character based (16x4) only in this release.
Interface: https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/LCD/Driver/ST7920.hh

3. Support for LowPowerLab Moteino
Board definition: https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Board/LowPowerLab/Moteino.hh
Arduino IDE: https://github.com/mikaelpatel/Cosa/blob/master/boards/lowpowerlab.txt
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.
Example: https://github.com/mikaelpatel/Cosa/blob/master/examples/Compiler/CosaDiff/CosaDiff.ino
Interface: https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Watchdog.hh#L133, https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/RTC.hh#L84
Usage pattern:
Code:
// Capture start time
static const uint32_t TIMEOUT = ....;
uint32_t start = RTC::millis();
...
// Check elapsed time
if (RTC::since(start) < TIMEOUT) {
  ...
}
Example usage: https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Wireless/Driver/RFM69.cpp#L228

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.
Code:
CosaWirelessPing: started

ping:nr=0,pong:nr=1
ping:nr=1,pong:nr=2
ping:nr=2,retry,pong:nr=3
ping:nr=3,pong:nr=4
ping:nr=4,retry,retry,retry,retry,retry,retry,pong:nr=5
ping:nr=5,pong:nr=6
ping:nr=6,pong:nr=7
...

https://github.com/mikaelpatel/Cosa/blob/master/examples/Wireless/CosaWirelessPing/CosaWirelessPing.ino
https://github.com/mikaelpatel/Cosa/blob/master/examples/Wireless/CosaWirelessPong/CosaWirelessPong.ino

Cheers!
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.
@MarsWarrior

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.

Cheers!
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?
@HeManHedman

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.

Cheers!
69  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 09, 2014, 05:15:15 pm
@MarsWarrior

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 (http://www.panstamp.com/), 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.

Cheers!
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 http://www.ikea.com/se/sv/catalog/products/60116540/ 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. https://github.com/mikaelpatel/Cosa/issues/181
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
https://github.com/mikaelpatel/Cosa/issues/180

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).
https://github.com/mikaelpatel/Cosa/blob/master/examples/Wireless/CosaWirelessRelay/CosaWirelessRelay.ino

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.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Soft/SRPO.hh
https://github.com/mikaelpatel/Cosa/blob/master/examples/Sandbox/CosaSoftSRPO/CosaSoftSRPO.ino

4. Soft Shift Register Parallel Input template class (Soft::SRPI<N>, 74HC165)
Input pin expander using 74HC165.
https://github.com/mikaelpatel/Cosa/issues/185
https://github.com/mikaelpatel/Cosa/blob/master/examples/Sandbox/CosaSoftSRPI/CosaSoftSRPI.ino
Code:
                      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
                 (GND)-----||-------(VCC)


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. https://github.com/mikaelpatel/Cosa/issues/184
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/LCD/Driver/HD44780.hh#L433
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/LCD/Driver/HD44780.hh#L569
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/LCD/Driver/HD44780.hh#L702

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).
https://github.com/mikaelpatel/Cosa/blob/master/examples/Blink/CosaBlinkTemp/CosaBlinkTemp.ino

For more details see the github commit log; https://github.com/mikaelpatel/Cosa/commits/master?page=1

Cheers!
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; https://groups.google.com/a/arduino.cc/forum/#!msg/developers/21G5w2HbUOg/bJtG94vEEhkJ

Cheers!
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. https://groups.google.com/a/arduino.cc/forum/m/#!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.
https://github.com/mikaelpatel/Cosa/blob/master/examples/Wireless/CosaWirelessButton/CosaWirelessButton.ino#L115
https://github.com/mikaelpatel/Cosa/blob/master/examples/Wireless/CosaWirelessReceiver/CosaWirelessReceiver.ino#L125

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

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