Translate

Xideco 0.2.0 Published

Update Contains Full Support For
 Raspberry Pi

Information about the new Raspberry Pi Bridge may be found here.

All Scratch blocks are supported including SONAR, Servo Control, and Analog Read (using an A/D converter).

Raspberry Pi Diaries


Jan 26, 2016


Part 7


Servo is now functioning and changes uploaded to Github.

Next is sonar (hc-sr04).


Evening Update

Sonar using an  HC-SR04 is functional - I can turn reports on and off and have Scratch display the report values (distance in centimeters).

Next is support for the PCF8591 YL-40. This is an i2c device that supports A/D conversion.

Once this is complete, I will be merging the Raspberry Pi Bridge into the Github Master Branch and and start to look at the BeagleBone Black Bridge. 

Another great day!

Raspberry Pi Diaries

Jan 24, 2016

Part 6

Last night, my Raspberry Pi Model B Rev 2 started acting erratically and then it decided to not even boot. I decided to rebuild the SD card and reinstall everything.

After flashing the SD card with the Raspian Jessie release, the PI booted up. I then proceeded to install everything I needed for the Raspberry PI bridge using my own instructions here.

I then installed the pigpio library.

Doing this on the Model B rev 2 (not to be confused with the Pi2) was a very slow process. To do everything took over 3 hours. I will be doing the same on a Pi2 in the future just to compare the differences in time to do a complete reinstall.

I installed the SD card into the Pi, it booted up and everything seemed right with the world again. I did  a shutdown of the Pi to make sure not to corrupt the image, unplugged it and went to bed. This morning I powered up the Pi and it wouldn't boot, so I thought I would swap the SD card into a Pi 2 to see if it would boot, and it did - the image was not corrupted. I swapped it back to the B and no boot. So I have a flaky Raspberry Pi B rev 2. I will deal with this later, but will continue work on the Pi 2.

Tone and Tone Off have been implemented. I can't believe how easy it was to do this using pigpio - what a wonderful library. I used some of the "wave" methods. The only confusing part was figuring out how to populate the "pulse" class entries to create audio frequencies.

Here is some commented test code using pigpio waves:

import time  # import the time library

import pigpio  # import the GPIO library

pin = 18

# establish 2 pulse definitions to create a 1k hz tone
# the first entry sets pin 18 high for a duration of 1000 microseconds
# and the second entry set pin 18 low for a duration of 1000 microseconds
tone_1k = [pigpio.pulse(1 << pin, 0, 1000), pigpio.pulse(0, 1 << pin, 1000)]


# remember to execute "sudo pigpiod" on the Pi before executing

#instantiate pigpio
pi = pigpio.pi()

# set the buzzer pin to output
pi.set_mode(pin, pigpio.OUTPUT)

# clear any previous wave descriptions
pi.wave_clear()

# create a wave descriptor
pi.wave_add_generic(tone_1k)  # 100 ms flashes

# create the tone and save the id
tone = pi.wave_create()

# play tone continuously for one second
pi.wave_send_repeat(tone)
time.sleep(1)
pi.wave_tx_stop()  # stop waveform

#clean up
pi.wave_clear()  # clear all waveforms
pi.write(pin, 0)



On to controlling servos next.


Raspberry Pi Diaries

Jan 23 2016


Part 5

I am testing the error paths on some of the blocks (enter a gpio pin number of 99, trying to do a digital write to a pin that was previously setup as an input, etc.). In my previous diary post I mentioned that I will be displaying debugger information as detailed text instead of reference numbers.

I have reconsidered this decision and am going back to reference numbers. The reasoning behind this is that approach is a burden on non-English speakers. If I use reference numbers and provide a cross reference of error number to English text string on the Wiki page, that page could be translated using something like Google translate. 

I am continuing to test error conditions and once I am satisfied with the error processing for the currently functioning blocks, I will go on to block functionality I have not yet addressed.

Here are the items yet to be addressed:
  • Tone
  • Servos
  • Sonar
  • Analog Input
For Analog Input, I just purchased an a/d converter module that is already supported by PIGPIO.  The module has a potentiometer and light sensor so it will be fun to play with.

Stay tuned.



The Raspberry Pi Diaries


Jan 22, 2016

Part 4

Some more progress to report. Uploaded the latest Rpi bridge to Github. The bridge is able to detect the board type (B, B+, etc.) and create a pin map of available GPIO pins for that board type.

If an operation is attempted on an illegal GPIO for the board type connected, it is detected, denied.

I am able to set the pin mode for Digital Input and Output from Scratch and the Enable/Disable function is now working.

If Digital Input is set to Disabled, reports are not sent back to Scratch.

If Digital Output is set to Disabled, performing a digital write has no affect on the pin.

The user can toggle back and forth between enabled and disabled.

If a digital or analog (PWM) write is attempted and the GPIO was not set to OUTPUT mode, the write is denied. 

To Do: Come up with a Raspberry Pi set of error messages and verify that they are being reported to Scratch for each error condition.

LATE EVENING UPDATE

Modified debug error reporting to be meaningful strings instead of reference numbers.

To Do: Update Arduino Bridge to do the same.

Control C handling working consistently well now.

SOLVED:

Xideco Installation Problems On Windows

Thanks to the quick action of the pyzmq developers, the problem has been solved.

Xideco Installation Problem On Windows

The pyzmq library was recently updated by its authors and installing this version (15.2.0) fails on windows. 

I have entered an issue on Github. Until the problem is fixed, I have put an installation workaround on the wiki. 

If you have any questions or problems, please let me know.

Thanks,
Alan