background preloader

Dr. Monk's DIY Electronics Blog: Raspberry Pi and Arduino

Dr. Monk's DIY Electronics Blog: Raspberry Pi and Arduino
Note. There is now a followup to this post here. The Raspberry Pi is creating quite a storm of interest. I have just got mine and one of the first things that I wanted to try was to get it talking to an Arduino over USB using Python. .. and you know what? Arduino Let's start with the Arduino end. Here is the sketch - paste it into a new Arduino IDE window and load it up onto your Arduino using your regular computer. const int ledPin = 13;void setup(){ pinMode(ledPin, OUTPUT); Serial.begin(9600);}void loop(){ Serial.println("Hello Pi"); if (Serial.available()) { flash( - '0'); } delay(1000);}void flash(int n){ for (int i = 0; i < n; i++) { digitalWrite(ledPin, HIGH); delay(100); digitalWrite(ledPin, LOW); delay(100); }}Raspberry Pi There is a Python library for serial communications called 'pySerial' which has history with Arduino. Step 1. Step 2. Step 3. Step 4. Step 5. Thats it! You type the parts after >>> import serialser = serial.Serial('/dev/ttyACM0', 9600) ls /dev/tty*

RasWIK - Raspberry Pi Wireless Inventors Kit Product description The Wireless Inventors Kit for the Raspberry Pi (RasWIK) is an exciting and affordable addition to the Raspberry Pi. RasWIK demonstrates that with our leading edge technology anyone (and we mean anyone) can build wireless sensors and actuators , you do not need huge experience, a degree or even any tools. We show you even how to connect the devices you build to “the Internet of Things” (IoT) service providers such as Xively. Getting started is just 5 simple steps: 1. You can build wireless devices in just a matter of minutes. There are 29 fully documented projects. Out of the box all the hardware is configured to start you off without you writing a single line of code. In a review of RasWIK in the October 2013 issue of Custom PC , Gareth Halfacree (co author of the Raspberry Pi manual) said: "It provides possibly the simplest platform for experimenting with wireless sensor networks I’ve ever seen." The youngest WIKer we know of is just 8 years old! Features: Downloads

Raspberry Pi meets Arduino - part 2 I gave a short talk and demonstration yesterday evening at the #raspberryjam event in Preston. I demonstrated the Pi raising some servo driven flags attached to an Arduino. I would have demonstrated communication in the other direction using a ultrasonic rangefinder, but I ran out of time. That can be my next post. Here is the code and details of the electronics for all this. Flags First of all the electronics. The servo control pins are wired to D2 and D3. The Arduino is powered by a separate power supply into its DC power socket. Arduino Here is the Arduino sketch. #include <Servo.h> #define MIN_ANGLE 30 #define MAX_ANGLE 160 #define SERVO_1_PIN 3 #define SERVO_2_PIN 2 Servo servo1; Servo servo2; int servo1pos = MIN_ANGLE; int servo2pos = MIN_ANGLE; void setup() servo1.attach(SERVO_1_PIN); servo2.attach(SERVO_2_PIN); Serial.begin(9600); void loop() if (Serial.available()) char ch =; if (ch == 'a') servo1pos = MAX_ANGLE; else if (ch == 'A') servo1pos = MIN_ANGLE; servo1.write(servo1pos); Python

Introduction: Pinewood Derby Race Finish Line: 14 Steps AdWords We use AdWords to deploy digital advertising on sites supported by AdWords. Ads are based on both AdWords data and behavioral data that we collect while you’re on our sites. The data we collect may include pages you’ve visited, trials you’ve initiated, videos you’ve played, purchases you’ve made, and your IP address or device ID. LiveRamp We use LiveRamp to deploy digital advertising on sites supported by LiveRamp. Doubleclick We use Doubleclick to deploy digital advertising on sites supported by Doubleclick. RocketFuel We use RocketFuel to deploy digital advertising on sites supported by RocketFuel. Twitter We use Twitter to deploy digital advertising on sites supported by Twitter. Facebook We use Facebook to deploy digital advertising on sites supported by Facebook. Sprinklr We use Sprinklr to deploy digital advertising on sites supported by Sprinklr. Dstllery We use Dstllery to deploy digital advertising on sites supported by Dstllery. Marin LinkedIn Demandbase Yandex AdForm Baidu Yahoo!

Arduino Preprocessor Directives Tutorial In Lightweight Arduino Library for ROHM Sensor Evaluation Kit, I introduced RohmMultiSensor – Arduino library that allows you to easily interface with multiple sensors in the ROHM Sensor Evaluation Kit. One of the core features of this library is that the program size is noticeably minimized by only compiling the parts of the library that contain the code specific for the sensor you want to use. This means that when you use less sensors, the overall program size and memory usage will be smaller. But, how exactly does that happen? And what is really going on behind the scenes when you #include a library and then press the “Upload” button? Hardware Arduino UNO Software Arduino IDE Almost everyone who has ever used Arduino has used a library. Arduino beginners should already be familiar with #include which “adds” the library to the main sketch. After you press “Upload” Let’s do a quick experiment first: start your Arduino IDE, open one of the example codes (e.g. Preprocessor basics or int Y = 10;

Arduino RPi Communication Desktop CT and 3D Scanner With Arduino: 12 Steps (with Pictures) CT scanning requires a source of radiation (e.g. x-rays or light) on one side of an object and detectors on the other side. The amount of radiation that makes it to the detector depends on how absorptive the object is at a particular location. A single image acquired with this setup alone is what produces an X-ray. The images collected by a CT scanner are called sinograms, and they display absorption of X-rays through one slice of the body vs. angle. The same principle is applied for the optical CT scanner with a camera acting as the detector and the LED array acting as the source. Photogrammetry requires the object to be illuminated from the front. While photogrammetry enables surface profiling of an object, CT scanning enables the reconstruction of the internal structure of objects.