Maintenance notice: These forum archives are read-only, and will be removed shortly. Please visit our forums at their new location, https://www.evilmadscientist.com/forums/.

Octolively with external sensors; communicate via ISP, or other pins?

edited November 2013 in Microcontrollers
Hi all-

A question I couldn't find answered; perhaps my search terms were incorrect.

If you have an Octolively system, and would like external inputs (and/or outputs), what is the best way to do this?

You could reprogram the system, via the ISP, but that would leave you with the current sensors.   Could you somehow use an Arduino (with its own sensors, inputs, outputs, shields, etc) to talk to the Octolively via that 6 pin connector?  I see  "Programming interface: Standard 6-pin AVR ISP (ICSP/SPI)", which sounds like you can use SPI (my own experience has been with I2C, but the idea of using SPI seems like it would work).  Have the Arduino handle sensors and other stuff, have the Octolively handle the lights.

Thoughts on this scheme?




Comments

  • Yes, the SPI interface is available.   

    Also, the Octolively already has 8 sensors onboard-- to operate those IR sensors --and 5 additional digital I/O lines normally connected to the neighbors.  That's up to 13 lines, 8 analog/digital, 5 digital.  Depending what you're trying to sense, the easiest option may be to repurpose some of the existing lines. 
  • Most excellent!    Is there a list of commands/example of using the SPI to talk say, from an Arduino?

    I see that the lovely USBtinyISP kit is needed to reprogram the Octolively, if needed.   Time to procure one posthaste.

    Is the source code just what is at github?  This does seem to have the current functionality, but don't see how SPI commands would be interpreted (unless I'm missing something completely here).

    https://github.com/oskay/Octolively/blob/master/firmware/octolively.c

    I do see that pins PB5, PB6, and PB7 are 'free', in that once new code is downloaded, they could be used.   If we were to reprogram the Octolively, perhaps those could be used as I/O pins.   I see this lovely bit (no pun intended) here in the code, which is hooked up to Pin B5, so a similar piece of code could be used for inputs using PB6 and PB7:
    int readButton() {  return (! bit_is_set(PINB, PINB5));}
    I also see:
    int receive_from(uint8_t dir)
    which apparently handles inputs PB1 through 4, but they are used for between board communication.   Haven't *quite* figured out how to configure an output, though.   I think I need to look at the code at this point for that, it seems that might be the ticket:
    DDRB  = ComOutputMask; // All B Inputs except for pin PB0, our output.
    PORTB = ComOutputMask | ComInputMask; // Pull-ups on input lines, output line high to start.

  • While there is an SPI hardware interface available, there is no software presently implemented to receive commands or codes over SPI-- the code would have to be written to do that.
  • Thanks; that's what I thought.

    I think the input stuff can be figured out by a copy/paste of the readButton; just have to figure out how to do output.

    A.
Sign In or Register to comment.