Go Down

Topic: Modular Stackable Microcontroller System (lots of pics) (Read 10 times) previous topic - next topic

WanaGo

Calling wire.begin(x) from inside the interrupt of the transmission from the Master seemed to work fine.

Module started as address 100.
Master started up.
I type 'A' into the Serial Terminal which goes into addressing mode. (Just as a test).
Master does a scan of all the devices on the bus, once a second.
In this case it reported back address 80 (my EEPROM) and address 100 (the module).
If an address == 100, assign it to the next available one, in this case I made it the last device before address 100, + 1.
So next address is 81, master then sends bytes 'A' and '81' to the module at address 100.
Module reads in the data, sees that an Address command has come in, reads in the new address and calls Wire.begin(81).
Master is still scanning the bus once a second, I see it change from 80 & 100, to be 80 & 81 on the bus :)

So proof of concept seems to work :)

liudr

Hope this becomes the first industry-regulation-approved arduino design soon!

My suggestion: you need HMI if you want to do automation, right?

WanaGo

#17
May 21, 2011, 12:28 am Last Edit: May 21, 2011, 12:53 am by WanaGo Reason: 1
Yep, an HMI is needed in alot of cases.

I have Ethernet, Bluetooth and RS232 Serial, so lots of possibilities of adding an HMI. RS232 most likely will be swapped for RS485 in the next revision.

I currently have a 24x8 character LCD with a serial backpack talking to my tower, all it needs now is buttons from the General IO board and its a very crude interface.

I have implemented the Modbus library in one of my previous designs, getting Modbus TCP and Modbus Serial working and they seem to go pretty well.

I even have an old school HMI here at home that I have borrowed from work, which speaks modbus RS232 and I have successfully populated that with data, made it draw sine waves etc.

A mate of mine started a Python interface with graphs and dials for a Dyno project which is still on the cards, however I am not sure how much further he wants to go with this.

Got some ideas?

liudr

I'm working on TUI and GUI on text LCDs and GLCDs. I have a phi_prompt library that one can use to construct HMI functions such as inputting numbers, selecting item from lists, menus of infinite levels, text inputs, text area displays with scroll (up/down keys), Y/N dialogs, OK dialogs. I didn't go as far as creating bar graphs or data charts on text LCDs but will consider it on GLCDs.

I use a four-directional pad plus two more keys for all inputs. The interesting thing for my buttons library is you can assign auto buttons that gets automatically pressed to save a physical button if you need, like inputting your name after beating the high score on a game console.

Take a look here see if you like any of the functions:

New features to be released next Monday:

http://arduino.cc/forum/index.php/topic,60830.0.html

Released features can be found here on my blog:

http://liudr.wordpress.com/libraries/phi_prompt/

WanaGo

Very nice work.

Implementing this on the 24x8 LCD's I have would be very cool.

This is where I got a couple from. They accept TTL level Serial or RS232 Level Serial, @ 19200 baud.
http://cgi.ebay.com/Intel-8032-Single-Board-Controller-Serial-24-x-8-LCD-/120726684894?pt=LH_DefaultDomain_0&hash=item1c1bdf04de

I have about 6 of them. They were $15 at the time when got them.

Nick Gammon


Calling wire.begin(x) from inside the interrupt of the transmission from the Master seemed to work fine.


I don't know that I would do that inside an ISR, but from what I can see doing another Wire.begin is the way to change the slave address.
http://www.gammon.com.au/electronics

liudr


Very nice work.

Implementing this on the 24x8 LCD's I have would be very cool.

This is where I got a couple from. They accept TTL level Serial or RS232 Level Serial, @ 19200 baud.
http://cgi.ebay.com/Intel-8032-Single-Board-Controller-Serial-24-x-8-LCD-/120726684894?pt=LH_DefaultDomain_0&hash=item1c1bdf04de

I have about 6 of them. They were $15 at the time when got them.


My library is built entirely over the LiquidCrystal library so if LiquidCrystal runs on this display, there is no reason the library won't run. Its layer is higher than hardware display driver library so I hope to port it to more displays with minimal work. What library do you use on your display?

Graynomad

@liudr
I've been watching your menu library with interest. I'm currently designing a LCD board (with RS485 for remote displays) and it might be good for that.

Unfortunately I only have room for 4 buttons, is it still a goer without the extra two?

@wanago
Re HMI, I've just got two 4D Systems 3.2" LCD with touch. Serial interface so they would be easy to use.
Re RS485, if you add RS485 all my modules I'm designing should work with your system and give you access to remote sensors, displays, GPS, accelerometers etc. I would still keep RS232 if possible though because there's a lot of legacy equipment you'll need to talk to.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

tastewar


@liudr
...
Unfortunately I only have room for 4 buttons, is it still a goer without the extra two?

...
______
Rob



I wonder if you could make up the last two buttons "logically" with a "chording" of some combination of other buttons...

liudr

You can always define any key as null button so they don't do anything or use any pins.

Say if you think you can get away with up/down/left/right, then define enter and escape as null buttons and you don't have to rewrite anything:

#define btn_null 255

phi_buttons btn_1(btn_u, LOW);
phi_buttons btn_2(btn_d, LOW);
phi_buttons btn_3(btn_l, LOW);
phi_buttons btn_4(btn_r, LOW);
phi_buttons btn_5(btn_null, LOW);
phi_buttons btn_6(btn_null, LOW);

This way your up/down function covers all change of values, left/right cover going from one number entry to previous/next one or jog in a text entry. Right/left arrow also dubs as enter/escape but you can certainly change its meaning. 100% useable. I was able to use all my stuff on even one button, an up auto button, and a right actual button. All you need it patience.

http://www.youtube.com/watch?v=2ceQeRX6R54

WanaGo

@liudr - Sadly the displays do not use the liquidcrystal library as they are modified AT terminal screens and have their own custom Serial protocol.
I have made a very crude library for them to prove the point of talking to them, and have made large digits etc.
Their controllers are actually graphic LCD controllers, however have firmware to make them characters only. That said, there is a TON of memory on them, so you can make a huge number of fonts or custom characters etc to make up menus, sliders, boxes etc. It would then just require the library to assemble the characters to form what you want. Just download the fonts to the LCD on startup.

So to get these working I would guess a bit of work needs to go into that.

The protocol is explains on this website.
http://www.pjrc.com/tech/mp3/lcd_protocol.html

The standard fonts are here:
http://www.pjrc.com/tech/mp3/lcd_fonts.html

@Rob - yeah I just need to find out what is wrong with my RS232, and I may make a selector switch or something to select between RS232 and RS485 - could be handy.
It will be awesome to be able to interface to all your stuff, that would be very nice.

Cheers
James

liudr


I wonder if you could make up the last two buttons "logically" with a "chording" of some combination of other buttons...


100% doable. Just define virtual buttons (combos) as null buttons and modify the wait_on_escape function so it recognizes combos as another button press.

This is a great suggestion. I will implement a combo button so you can just say:

phi_buttons btn_6(btn_combo, LOW);
btn_6.setCombo(btn_1,btn_2);

So btn_6 becomes a virtual button that gets pressed when both are pressed down and released when one of them is released. I just need time to make it happen more elegantly, like I just mocked up.

WanaGo

If you are intested at all, here is a crude library I whipped up and the sketch to test it out.
It may be able to be integrated into a version of your system since it does fairly standard things like move cursor, print, etc. Its just those functions had to be defined based on the protocol.

Here they are if you are interested. Very cool having a large character display like this.

http://www.taktik.co.nz/Arduino/LCDFonts.h
http://www.taktik.co.nz/Arduino/LCDFonts.cpp
http://www.taktik.co.nz/Arduino/LCD_Large_New4.pde

liudr

I was just about to ask what you have for that display. I'll take some time to read it. I got an abstract deadline next week so hopefully will get to it very soon.

Just IMHO that if you base on this display you may have trouble secure enough stock compared with HD44780 displays.

I believe all I used were:
clear()
setCursor(int, int)
print(char *)
write(char)
and
createChar(int, char*) only for scroll bars that mowcius asked :) A less decent version would be using a black box and white box for less accurate scroll bar. I really don't want to let the scroll bar go, so DOS.

Everything was based on the above.

WanaGo

Cool.

Yeah I wouldnt use these displays if they were ever for sale, as you said, stock issues.
They are an old display now, and really the only place you can get them is from this guy on ebay. He brought like 3000 of them some years ago, and is just selling off his stock.
PJRC used them on their MP3 player they developed and sold as kits, which was before ipod times.
I got my first display back then too, and just recently got a few extras from ebay cos they are so cool.
They dont have a backlight though which is a shame.

I wish you could get displays this size new. 16x2, 20x2, 20x4 etc just arent enough in alot of cases. And most graphic displays are small too.

*sigh*

Go Up