# What to do when there are no pins left!

1. ### perplexabot

284
Hello all! Let me get straight to the point. I will be using the Raspberry Pi and the Enocean Pi 902 along with some other components.

My problem is due to the fact that the Enocean Pi 902, when plugged to the Raspberry Pi, completely uses all the pins. If I only wanted to use the Enocean Pi this would not be a problem. But I need at least one pin for other purposes! The way I see it there are two solutions:

1. Use a shift register (parallel in serial out)
2. Use another microcontroller (mc) with wifi capabilities to communicate with the original microcontroller.

The problems with these solutions:
• Using a shift register
• I feel like this may require a bit of work. Everyone knows, less work is better : )
• I would need to introduce a clock (if I am not mistaken) and this will add complexity
• Using another mc
• It would be overkill (too much computing power for my needs).
• Costly! Too expensive when compared to the job it will be doing (assuming I buy another RaspPi and a wifi dongle).

Does anyone have any suggestions or ideas? Are there any mc's that are simple, inexpensive and have the ability to connect to wifi?

EDIT: This may be kind of off topic and for that I apologize. If I do get an answer, regarding what I will ask in this edit, I will open a new thread specifically for it. Has anyone used an Enocean pi (Because I have a couple of questions)? Believe it or not, I tried to go to the enocean forums and it turns out you need a paid membership in order to post! This is wrong in so many ways. Nice job restricting the proliferation of knowledge enocean!

Last edited: Dec 30, 2013
2. ### Baluncore

3,305
I think it comes down to how many thousand you need to manufacture. Maybe it is time to stop playing with educational toy blocks and actually engineer an economic solution.

3. ### perplexabot

284
Manufacture? I am using this for a senior design project!

Educational toy blocks? This is for educational purposes!

I sincerely thank you for your time and effort that went into this reply; however, I can't help but feel that your answer contains no practical suggestions or ideas.

Is this your way of trying to win that $75 gift card? Anyone else have any suggestions? 4. ### Okefenokee 245 Do you have a spec sheet for the enocean? If it uses I2C or SPI then you may have a way out. Those protocols can be daisy chained. Do you have a lab with a Pic programmer? You can get a fast Pic12 for like 2 bucks. The nice thing about RPi is that you can install the I2C functionality for its Linux version then send commands to an mc using command line scripts in linux. You just open a linux shell in your program (Java or C) and you'll have a way to communicate. Another possibility would be to get an mc with lots and lots of I/O pins. Pretty much any mc would have the I2C interface. You could use it like a port expander. This all depends on what the Enococean software does inside the RPi. If it grabs the entire GPIO resource and doesn't share then I wouldn't be sure how to get around it. An mc solution really isn't overkill. They're cheap and there's plenty of free IDE's to program them. You can get code samples to use as a starting point. The main holdup would be the programmer and programming circuit. The Pic programmer runs about$60 US. You can build a programming circuit on a breadboard.

Did I mention that I like Pic's? They're pretty neat. They generate the clock internally. That means you hardly need any components at all. You need a pull up resistor for each I2C pin, a few decoupling capacitors, programming resistors (optional for in-board programming), and you're done.

By the way, I've worked with the RPi before. Are you already using the P5 header? There's an unmounted header there that you can solder underneath the board. It will give you 4 more GPIO pins or one I2C interface and 2 GPIO pins.

Last edited: Dec 30, 2013
1 person likes this.

### Staff: Mentor

He was just trying to be helpful -- you did not state in your OP what your goal was. My company is starting to use the R-Pi for a moderate-volume application, for example, so I had a similar response to your OP until I saw your "school project" reply.

Can you use the USB connection for an IO expander?

1 person likes this.
6. ### perplexabot

284
Sorry for the late reply! Have been googling some of the info in the previous replies!
Wooow! So much information. Thank you!

I am not too familiar (if at all) with communication protocols. Yes, I do have the data sheet (along with the user manual). I believe it uses UART as the serial protocol

[EDIT: actually after a bit of reading I think the protocol is something called ESP3! stands for enocean serial protocol 3. Just wanted to clarify!].

I did some research on daisy chaining and this technique seems pretty cool! I don't think this will work however, I may have needed to state that the components that need the extra pins are not mc's but components such as solenoid valves and leds (not so sure what such types of components are called, maybe passive components?). Either way I now know about daisy chaining and that is awesome.

I have no experience with PIC whatsoever. It wasn't until now that I found out that this is a mc! How embarrassing. Are you saying I can daisy chain the PIC mc with the enocean PI (assuming it is I2C or SPI)? I guess that would be a cheaper approach and probably more practical, the down side being I have no experience with I2C communication protocol.

I am not so sure I can use another mc (unless hacks are use) since the enocean pi is made specifically for the RPI.

I am not so sure. Physically, yes, it does use all the P1 header pins on the RPI. Logically, I am no so sure, I assume that since it attaches to all the pins, it does use all of them (not sure though).

I guess you are right. I was thinking it was overkill if I got another RPI and a WIFI dongle. But your PIC mc along with the I2C protocol suggestion seems to be pretty well balanced for the job. The problem with this though is that I have no experience with PIC or I2C. I would love to learn about them (and I hope I will in my spare time), but with the 10weeks I have to complete this project and the lack of man power (only I am working on this project), this approach is scary! I am not so sure I will be able to complete all the project.

Thank you so much, you have helped me in so many ways! I now know about daisy chaining, PICs and a little about I2C and SPI. AMAZING!

You are right. I am sorry for my rude reply Baluncore : ( I thought you were trying to be offensive...

I just researched USB IO expander! WOW! I didn't know these things existed. I wonder how they are used? I will need to research these in my free time. Definitely good to know! Thank you Mr.Berkeman, as always.

Physics forums is awesome (this is no surprise).

Last edited: Dec 31, 2013