Show Posts
Pages: 1 2 [3] 4 5 ... 29
31  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!
32  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
33  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!
34  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!
35  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!
36  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!
37  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.

38  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!
39  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!
40  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!
41  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!
42  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!
43  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: May 31, 2014, 05:46:22 pm
Two new Cosa example sketches that might be of interest:

1. TWI/10DOF
A new TWI example sketch demonstrates how to use a 10DOF module and display sensor readings on a LCD. The test setup is an Arduino Pro Micro with a GY-80 10DOF module, HD78440 (aka 1602) LCD with a GIICLCD TWI adapter running on a 1100 mAh 3.7V LiPo battery.
https://github.com/mikaelpatel/Cosa/blob/master/examples/TWI/CosaLCD10DOF/CosaLCD10DOF.ino

2. Ethernet/WebServer
The new Ethernet/Webserver example sketch demonstrates how to respond to HTTP GET requests by reading files from SD/FAT16 disks.
https://github.com/mikaelpatel/Cosa/blob/master/examples/Ethernet/CosaSDWebServer/CosaSDWebServer.ino

3. Pin Benchmark Statistics
Below is a link to the latest statistics for the Cosa Pin class benchmark (CosaBenchmarkPins.ino) for the old and new AVR toolchain.
https://dl.dropboxusercontent.com/u/993383/Cosa/calc/CosaBenchmarkPins.ods

4. Updated Ethernet/WebServer with Pin status.
More dynamic HTML generation for the CosaPinWebServer example sketch. Generates table with digital pin state and chart with analog pin reading (scaled 0..99).

https://github.com/mikaelpatel/Cosa/blob/master/examples/Ethernet/CosaPinWebServer/CosaPinWebServer.ino

Cheers!
44  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: May 31, 2014, 05:23:00 pm
I spent some time understanding the packet being sent, what I want to do is print out the NR value and a member of the payloads value on an lcd screen. I've managed to run the example code, and it outputs these values to the Uart trace fine. What I'm wondering is how to take some of these values and concert them to integers so I can either store them or print them to the lcd screen. I'm using the payload type of message and am having trouble getting the NR member's value into an integer.

Thanks a lot for this project there is a lot of interesting stuff in here. Sorry I'm pretty green when it comes to coding.
You are welcome!

There are a number of examples of how to use the Cosa LCD. If you can print to the UART you can do the same with the LCD. They are both IOStream::Device's and you can simply bind trace to the LCD.

The rest of your questions are difficult to understand without some code. You must understand the basic data types in C/C++ and how to convert between textual and binary representations. Most of the necessary conversions are done by the IOStream class.

Cheers!
45  International / Scandinavia / Re: Hur får jag en billig RF 433 MHZ modul att sända när jag aktiverar en knapp? on: May 31, 2014, 09:50:31 am
Kanske mer än du behöver? Nedan "skiss" använder näst intill ingen ström i väntan på att man trycker på en knapp. Vid knapptryckning läser den två analoga värden och skickar som meddelande tillsammans med tidsmärke och batteristatus. Kan konfigureras för att använda CC1101, NRF24L01P, RF433 eller RFM69. Kan köras på de flesta Arduino men också ATtiny. Skrivet i Cosa.

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

Mikael
Pages: 1 2 [3] 4 5 ... 29