Society of Robots - Robot Forum

Mechanics and Construction => Mechanics and Construction => Topic started by: hazzer123 on April 28, 2009, 06:34:08 AM

Title: Community Project: Scanning sensor module
Post by: hazzer123 on April 28, 2009, 06:34:08 AM
Ok I guess ill start off. The module i will first design is a Scanning Sensor Module (SSM). It will control a servo and take readings from an analogue sensor (Sharp IR for example).

I will try to document the module making process as thoroughly as I can, but this is also my first time formally designing and building, so be patient :)


                              +-------------------------+                 
Sensor ----analogue data----->|    Scanning Sensor      |<----I2C data---->[Other modules]
Servo <---PWM data------------|         Module          |
                              +-------------------------+


I think the SSM should have a multiple modes of operation.

They kind of data transferred on the I2C channel are instructions and data.

I think that's all for now. I'll make it on a member page later.

What do you think? Any added functionality?
Title: Re: Community Project: Scanning sensor module
Post by: Asellith on April 28, 2009, 11:06:52 AM
Looks great and a good idea/addition to the module list. One thing that sticks out to me. First with continuous scanning mode it might be better to store a lot of data and have the master get a big array dump every once in a while instead of all the time. So instead of sending data for every degree you would store all the data and send it after 180 degrees or 90 degrees. Also would be nice to have settings so that the main controller can ask for a 90 degree or 360 degree scan.
Title: Re: Community Project: Scanning sensor module
Post by: hazzer123 on April 28, 2009, 11:12:16 AM
Great thanks Asellith.

Yeah there should be a load of configurations inside the module for things like speed of scan, angle increment between readings, scan range, etc. Can you think of any others?
Title: Re: Community Project: Scanning sensor module
Post by: Asellith on April 28, 2009, 12:09:14 PM
An automatic alarm mode maybe. Something that can be set for a specific distance and then you only get an alert when something enters that range. So it can scan the front of the robot for objects. Also might be a good thing to be preprogram some common sensors into it. Also a custom one. This will just load a set value for the conversions based on the sensor used. Like if you use the EZ1 ultrasonic sensor or the sharp IR module it would work with several and then a way to custom set the value for anything else the user wants to put on it.
Title: Re: Community Project: Scanning sensor module
Post by: chelmi on April 28, 2009, 12:50:50 PM
An automatic alarm mode maybe. Something that can be set for a specific distance and then you only get an alert when something enters that range.

Maybe I missed something, but if this module is a i2c slave, then it cannot initiate a transfer to send the alert. The master will have to poll to get the warning.
Title: Re: Community Project: Scanning sensor module
Post by: hazzer123 on April 28, 2009, 12:52:28 PM
This one could be a master too :)
Title: Re: Community Project: Scanning sensor module
Post by: dellagd on April 28, 2009, 06:02:24 PM
I'm pretty sure masters can report to other masters, like a grand master master ( bow down to me, I am the master of all masters! (sorry I just had to put that)) also there should be a mode where it gets told to go to one position and then continually scan at that position.
Title: Re: Community Project: Scanning sensor module
Post by: Ro-Bot-X on April 28, 2009, 07:46:57 PM
Nice idea, the module could also be small size, a Tiny25/45/85 could do the trick easily. It has PWM, analog pins, TWI, all in 8 pin DIP. No hardware problems. The magic is allways in the software...
Title: Re: Community Project: Scanning sensor module
Post by: hazzer123 on April 29, 2009, 02:34:58 AM
Could this programmer (http://www.sparkfun.com/commerce/product_info.php?products_id=14) (used in the $50 robot) program the ATTinyx5 series? The sparkfun page doesn't list it, but support for these chips has been recently added in the ponyprog software.

I'm a PIC guy... but these chips seem much nicer for this application.
Title: Re: Community Project: Scanning sensor module
Post by: Ro-Bot-X on April 29, 2009, 05:54:25 AM
Yes, it can program any Tiny chip if the support is added in the loader program (PonyProg).
Title: Re: Community Project: Scanning sensor module
Post by: hazzer123 on April 29, 2009, 01:15:57 PM
Oh i just had another thought... How about a mode where the data passed back has already been processed (with simple trig) into an array representing the location of detected objects.

So the scanning range could be divided up into a 10x10 grid (for example) and there could be 3 states of each cell in the grid:

Cell empty.
Cell occupied.
Cell contents unknown (cell is behind an object).

This could be nice i think.
Title: Re: Community Project: Scanning sensor module
Post by: Asellith on April 29, 2009, 02:52:22 PM
My advice on this is to get a simple version running as all the changes your mentioning involve software. So after time you can develop better firmware for the module and release it in stages. This will keep interest in the module fresh and your time to market will be shorter. That way you don't spend the next 3 months perfecting code that work for 75% of the people but some special mode is giving you trouble.
Title: Re: Community Project: Scanning sensor module
Post by: hazzer123 on April 30, 2009, 04:42:17 PM
So i've quickly made a spreadsheet of some of the various registers that will be needed in the module. - http://spreadsheets.google.com/ccc?key=rFsIT1y91nUqPNOPxtiEGaw (http://spreadsheets.google.com/ccc?key=rFsIT1y91nUqPNOPxtiEGaw)

This is the kinda format i think we should go for in all the modules.

These tables will be placed in the manual along with detailed descriptions of what all the jargon means etc.
Title: Re: Community Project: Scanning sensor module
Post by: Trumpkin on April 30, 2009, 06:41:59 PM
It won't allow me to see the spreadsheet.
Title: Re: Community Project: Scanning sensor module
Post by: Webbot on April 30, 2009, 06:54:21 PM
Same for me. Just get access denial msg.
Title: Re: Community Project: Scanning sensor module
Post by: hazzer123 on May 01, 2009, 01:28:46 AM
Oops sorry guys. Here is the spreadsheet published as a webpage -  http://spreadsheets.google.com/pub?key=rFsIT1y91nUqPNOPxtiEGaw (http://spreadsheets.google.com/pub?key=rFsIT1y91nUqPNOPxtiEGaw)
Title: Re: Community Project: Scanning sensor module
Post by: SmAsH on May 01, 2009, 01:41:12 AM
that looks like a great way to have things set out. should we make this standard for all modules created?
Title: Re: Community Project: Scanning sensor module
Post by: dellagd on May 01, 2009, 05:36:17 AM
can someone plz explain this, and plz excuse my noodishness
Title: Re: Community Project: Scanning sensor module
Post by: Ro-Bot-X on May 01, 2009, 06:06:49 AM
1. You should add Ping))) sensor to the sensor byte.
2. You are talking about RAM, not EEPROM, right? I sugest to save the last register configuration in the EEPROM, especially the I2C address. Someone might want to change the address if it uses more than one module, so it needs to be saved so it doesnt have to repeat the change every time. Some other registers might need the same thing.
Title: Re: Community Project: Scanning sensor module
Post by: Webbot on May 02, 2009, 11:49:18 AM
You are talking about RAM, not EEPROM, right? I sugest to save the last register configuration in the EEPROM, especially the I2C address. Someone might want to change the address if it uses more than one module, so it needs to be saved so it doesnt have to repeat the change every time. Some other registers might need the same thing.

I2C addresses are worthy of thought. Each SoR module type should come with a unique address but you still have the problem of connecting more than one of the same type of module as they will have the same address. So should the address be configured via jumpers/switches (adds space and cost to each module but simple to use) or by having an I2C command to change the address which is then held in EEPROM. The second method is a bit more complex for noobies. If they buy two 'scanning sensor modules' and these come with a default address of 0xB0, say, then they will need to write a small program to send a command to one of the modules to reconfigure its address. However: if 'everyone' can decide on a single command that works with ALL modules then this config program could be used to re-configure ANY module - making it easier all round.
Title: Re: Community Project: Scanning sensor module
Post by: SmAsH on May 02, 2009, 04:14:16 PM
i agree that the addresses should be easily configurable for ease of use. i i don't know about the switch route....
what happens if joe wants to have 3 or 5 scanning modules...
we don't want a clunky dip switch do we?
do you guys think the slave chip on the board should be easily re-programmed?
i mean with easy access to the programming pins?
Title: Re: Community Project: Scanning sensor module
Post by: dellagd on May 02, 2009, 04:50:51 PM
hmmm....
I think the answer should be yes unless it is possible that we could program the mod through a master?
Is this even possible?
Title: Re: Community Project: Scanning sensor module
Post by: SmAsH on May 02, 2009, 05:04:02 PM
maybe... but that may be getting too complicated and veering into territory we were not meant to go into.
Title: Re: Community Project: Scanning sensor module
Post by: Asellith on May 02, 2009, 05:43:48 PM
The PCB designs for home use should have access to the programming pins. Not sure if you make a commercial version if that is necessary. Might not be a bad idea to include code to change the address of a slave. Its just a number stored in a register. So you connect it to a master with a custom program that just sends the commands to the current address and a issues a change to another address. Might be worth having someone with some decent programming skills making a utilities library that can be used to do some crazy stuff. Something we may need to include is a handshake command that basically just says yes something is attached to this address and I am a whatever. The you could scan all the addresses and get returns from the network.

Actually now that I think about it a serial to I2C and USB to I2c module would be great. Then you could debug stuff from a PC.
Title: Re: Community Project: Scanning sensor module
Post by: SmAsH on May 02, 2009, 05:49:47 PM
wouldn't a usb-I2C module just be a small chip, like the one on the roboduino/arduino? forgot the name now... but of coarse with some other stuff too. all the basics...
Title: Re: Community Project: Scanning sensor module
Post by: dellagd on May 02, 2009, 06:14:09 PM
heres an idea
dont know if this is possible, but could we make a mod (master) that has the ability to take inputs from a computer via a usb?
then we could make a simple program that has access to the USB port and via that port the I2C master gets signals, and based on thoes signals the master can carry out operations, be it changing a slaves address.
Title: Re: Community Project: Scanning sensor module
Post by: Asellith on May 02, 2009, 06:18:31 PM
Yes its called the axon. :)
Title: Re: Community Project: Scanning sensor module
Post by: SmAsH on May 02, 2009, 07:33:14 PM
hah! all you would need is an mcu with uart capabilities so you can hook up a usb.
two possible masters for this project could be axon for more advanced users and the $50 board with more pins accessible and a usb connection for the beginners who dont want to fork over $130.
Title: Re: Community Project: Scanning sensor module
Post by: Webbot on May 02, 2009, 07:44:52 PM
There are certainly some commercial USB to I2C boards already out there so I think your efforts would be best targeted elsewhere as I'm not sure there is much you could add.

Re issuing a ping to all boards then you can issue a 'general' request to address 0x00 which, if the I2C is set up to receive, then it can take action (so its like a 'broadcast' to all slaves). However: the slaves cannot respond to the msg (as far as I know) because they would all be trying to talk back on the bus at the same time.
Title: Re: Community Project: Scanning sensor module
Post by: dellagd on May 02, 2009, 08:48:11 PM
Yes its called the axon. :)
oh :P
cool!
maybe could the masters be Axons and the slaves be like $50 boards.
Title: Re: Community Project: Scanning sensor module
Post by: Asellith on May 02, 2009, 09:02:03 PM
Master just means it can take control of the bus and send a message. Slaves have to be told what to do. They wait for a master to send them a command and then they do what it tells them and either send back an acknoledgment that they did it or they give the master the data it asked for I.E. sensor data. Inside the OSCAR system an axon can be a master or a slave. That depends on programming.
Title: Re: Community Project: Scanning sensor module
Post by: dellagd on May 02, 2009, 09:05:25 PM
I know that
I was saying that the axons powers would come in handy as a master
Title: Re: Community Project: Scanning sensor module
Post by: SmAsH on May 02, 2009, 09:47:34 PM
axon doesn't really have much more in the area of powers for I2C as an roboduino... roboduino has a faster processor, little less memory and $90 cheaper...
and PS: this isn't the thread for this stuff. we need to keep it organized or it may fail again :o
Title: Re: Community Project: Scanning sensor module
Post by: Razor Concepts on May 02, 2009, 10:04:20 PM
Axons would be a little too pricy.

Does a default "master" board have to be part of the project? Maybe one can be made but it would be great to allow different MCUs with I2C to communicate with the slave boards. This way people with experience can use whatever MCU they are familiar with to control everything.
Title: Re: Community Project: Scanning sensor module
Post by: SmAsH on May 02, 2009, 10:17:17 PM
nope, axon was just a candidate because it was made by the admin..
any mcu with I2C should do fine..
hell even an atmega8 would do...
Title: Re: Community Project: Scanning sensor module
Post by: Ro-Bot-X on May 03, 2009, 05:54:53 AM
axon doesn't really have much more in the area of powers for I2C as an roboduino... roboduino has a faster processor, little less memory and $90 cheaper...
and PS: this isn't the thread for this stuff. we need to keep it organized or it may fail again :o

Axon has the same speed as Roboduino, 16MHz!
Title: Re: Community Project: Scanning sensor module
Post by: dellagd on May 03, 2009, 06:32:38 AM
maybe admin would give us a discount since this is SoR OSCAR
Title: Re: Community Project: Scanning sensor module
Post by: dellagd on May 03, 2009, 06:39:09 AM
heres an idea
dont know if this is possible, but could we make a mod (master) that has the ability to take inputs from a computer via a usb?
then we could make a simple program that has access to the USB port and via that port the I2C master gets signals, and based on thoes signals the master can carry out operations, be it changing a slaves address.
Quote from: Asellith
yes its called the axon  ;D
this is why I thought we should use the axon if you didn't catch this part
Title: Re: Community Project: Scanning sensor module
Post by: Asellith on May 03, 2009, 07:02:11 AM
Ok just to clarify the OSCAR was designed to work with the Axon. We chose our PCB designs to make it fit nicely with it because the dimmensions of the board don't matter that much but tailoring it to the axon benefits a lot of people.

NOW: The axon is not the only main controller possible. This system is very flexible. The main controller does not have to fit into the standard. I hope to see several boards that comply to the standard and include things like PICAXE, PIC, and even BASIC boards. The possibilities are endless. You could even use a computer. If you have a roboduino then use it. The only stipulation is you need to talk on the I2C bus. For some devices (I.E. Computer) an interface board would be needed.

The standard is designed to be really loss for a reason. We want everything to talk nice and fit nicely together but in the end the sky is the limit. If you want to see a feature then build it. The more modules we see the better. I would even like to see several versions of the same modules using different tech. Basically a AVR and a PIC version because most people stick with one or the other.

Just a side note. for a really complex design the system could support several controllers. So you could be processing video on a laptop while an axon controls sensor inputs and navigation with a few smaller units coordinating servos or something.
Title: Re: Community Project: Scanning sensor module
Post by: hazzer123 on May 04, 2009, 05:22:31 AM
We should have variable length registers (whole number of bytes only though obviously). To execute a command, you just write to a register that has a length of 0 bytes. This should be standardised across the whole platform.

Examples of 0 byte length registers are "Save user settings to EEPROM" and "Reset module".

I think that, for thoroughness, the modules should have registers which contain the firmware revision number, a module ID (a unique number we give to each of the modules) and a module name (~16 byte ASCII null-terminated string which the user can overwrite).

More specific to this Scanning sensor module -
I think the storage of multiple look up tables for each possible sensor is silly. Changing of the sensor connected to the module will happen infrequently and so it is a waste to store the data. It would require an extra external EEPROM chip, and that is just unnecessarily complex. Instead the user will just have to use I2C or their programmer to send and store a single LUT on the MCU's internal EEPROM.

Another (closely related) idea was the module's own internal conversion between units (volts, cm, inches...). This is now unnecessary since if the user wants to convert to inches (i can't ever see them needing to do this while the robot is running anyway) then they just unload a new LUT to the module.

This module should also support sensors which output a pulse where the width is related to the sensor reading.

Do you think that LUTs are a good idea for the sensor data conversion? Or do you think we could use some more maths instead? Maybe we could approximate sensor characteristics with a polynomial. The ATTinyx5 series has 2 cycle multiply so this would be easily achievable. And all we would have to store in the EEPROM is a few coefficients. Actually i will look into this aswell, seems sensible :)

I will change the spreadsheet i posted earlier and re-publish it soon.

EDIT: Ooops i read the wrong datasheet. The ATTinyx5 series don't have hardware multipliers, ill have a look at the software implementations and see if approximating sensor characteristics is still possible with power series.
Title: Re: Community Project: Scanning sensor module
Post by: fiflak666 on May 05, 2009, 06:18:04 AM
hi guys, you're not the first who tries to build "Scanning sensor module"

I know two amateur-made robots that use this kind of stuff, both from Poland and both minisumo type

- Hunter
http://www.dioda.com.pl/forum/topics7/robot-minisumo-lowca-vt1756.htm (http://www.dioda.com.pl/forum/topics7/robot-minisumo-lowca-vt1756.htm)
Robot Challenge 2009 Wien Łowca / Hunter 141 part1 (http://www.youtube.com/watch?v=0c0XWadAkRI#lq-lq2-hq-vhq)

- and mine, KISS 2 (still under construction); mine uses Atmega16, two Tower-Pro servos, two SHARP sensors and SPI/UART interface; looks like this:
Title: Re: Community Project: Scanning sensor module
Post by: Asellith on May 05, 2009, 06:37:36 AM
Yes but we are the first to make it comply with a standard that hundreds of future modules will comply with :)
Title: Re: Community Project: Scanning sensor module
Post by: SmAsH on May 05, 2009, 06:47:50 AM
yep, check out the original thread in the misc section...
Title: Re: Community Project: Scanning sensor module
Post by: dellagd on May 05, 2009, 07:27:03 AM
I think this project could make it big, like a revolution in robotics
Title: Re: Community Project: Scanning sensor module
Post by: SmAsH on May 05, 2009, 02:27:38 PM
that's what were hoping for ;D
Title: Re: Community Project: Scanning sensor module
Post by: hazzer123 on May 10, 2009, 12:17:28 PM
Ok, so i have build a circuit using stripboard and im going to create software for the first prototype over the next few weeks (i have exams to study for too... so not much time to dedicate to this project right now).

It seems that for now this module will have to be a slave only, until i can either find code for the ATTiny85's USI which supports I2C with multimaster arbitration, or i write my own. The USIDC (Data Output Collision) bit in the USISR register may make this easy. But anyway, for now slave only will be fine and it should be easily extend-able..