Picaxe as an efficient I2C slave to RasPi: one caveat

kranenborg

Senior Member
The Picaxe and the Raspberry Pi are two quite different beasts but they appear to team up rather well. In particular the straightforward implementation of the I2C protocol by the Picaxe X2 variants (using the scratchpad RAM) makes the X2 chip a very useful companion as an I2C slave to the RasPi (which lacks basic ADC functionality as well as real-time operation) for extending the RPi's outer hardware layer towards a "truly embedded" computer system.

I came across Rahul Kar's website as a very clear, simple and inspiring example:
http://www.rpiblog.com/2012/11/interfacing-adc-with-raspberry-pi.html
His hardware setup is based on the older 28X1

There is one caveat though: it may not work with an X2 (as I tested with an 28X2), the Picaxe speed needs to be increased to 16Mhz to make his example work!

I have attached my working 28X2 program (with some comments and few code extensions), Rahul's RasPi python code can be used directly.

/Jurjen
http://www.kranenborg.org/electronics

View attachment 28X2_SlaveToRPi.bas
 
Last edited:

kranenborg

Senior Member
Hi MFB,

Of course your argument is very valid in general. Also, a significant number of published RasPi applications can be implemented much more efficiently and easier with a microcontroller like the Picaxe or other smaller computer. Still, I expect that small but very powerful (but also powerhungry compared to microcontrollers) web-enabled computers like the RasPi or others will have a very visible place in the future (I have a full Joomla 3.2 website running on my RasPi for example), and I foresee that many of them will lack a full interface (except for I2C) just because of cost reasons. Here the picaxe could serve very well in providing the outer interface layer. Yet, Ibenson has shown recently that even a Picaxe can provide for a website too, given a very specific application: http://www.picaxeforum.co.uk/showthread.php?25050

/Jurjen
 

MFB

Senior Member
Hi kranenborg,

I have always thought that the Maximite would be the most logical progression from the PICAXE for those needing low cost computer power. If you need even higher performance and graphics resolution then consider using an Android tablet. These are increasingly comparable in price to the Pi, when the cost of the touch screen and power supply are included. Android tablets offer low power operation and are supported by a wide range of languages, including good old Basic.
 
Top