title title title title

Selected Arduino, Raspberry-Pi and General Electronics Projects

Besides some great projects, there are also summaries of meetings and classes included on the Electronics page.


LFSR

Linear Feedback Shift Registers


Arduino Controlled LFSR

Encrypt message via LFSR and decode with XOR gate

LFSR - USING ARDUINO

This project is best described in the video referenced below, but the gist of the project is to further investigate the use of shift registers to do digital work. Here we provide feedback for a 24 bit shift register from four Q-outputs along the way that define a bit stream that has been optimized for length by this selection. The bit pattern doesn't repeat for 16,777,215 clock cycles. This gives us room the blend a digital message with an XOR gate. This in affect encrypts the message into the bit stream. If another LFSR arranged the same way is used to blend it's output with the encrypted message input, only the message emerges from the XOR gate. Thus if the transmission is separated from the receiption an effective encryption transmission can be realized.

This also provides us a platform to learn all sort of digital techniques controlled by a microprocessor.

How all this is done is shown in a YouTube video. To watch the video, click here.



SerialChip

Custom Serial Interface


Arduino Controlled Serial Interface

8-bit input read into an Arduino. Serial output to shift register back to 8-bit LED Display

SERIAL INTERFACE - USING ARDUINO


This project shows a custom serial interface starting with 8 push bottons to provide a parallel byte of data for a 74HC165 shift register. The data will be serially clocked into an Arduino Uno under software control into a byte variable. The sketch will use the Serial Monitor screen to send an ASCII letter to tell the Arduino to send one of three bytes on to a 74HC595 shift register as serial data to be converted into a parallel byte output once a latch signal is issued. The sketch will also print out all 8-bits onto the monitor screen (one space between nibbles for ease of reading). Once the serial data is in the 595 chip and latched into the output register, it will be made available to an LED display by clocking a TPIC273 D-latch buffer chip. The sketch can clear the display and send a byte to any of three byte rows of LEDs under software control by matching one of the ASCII letters sent by the user. The letter 'd' will clear the display.

How all this is done is shown in a YouTube video. To watch the video, click here.

There is an associated set of information that forms the foundation for this serial interface demo that can be reached here. This will be a series of demo projects based on this information.



Stepper

Software Monitor Motor Currents


Using a stepper motor and current monitor

Measuring current is challenging, because the meter is in series with the circuit and currents can vary wildly.

CURRENT SENSING - USING ARDUINO


The SparkFun current sensor (INA169) is hardware programmable to various ranges of current reading capability. In this case, the RS seen in board image is a 1 ohm for a scale of 35 - 350ma. This is fine for this stepper motor. If you want to go higher, you can replace the 1 ohm resistor for a 0.1 of an ohm to get 350ma to 3.5A. This is about it for this design. The best thing about this device is it can sense with an input voltage up to 75V, so it can be used with 12V or 24V, but you have to scale the other resistor RL so the ADC input voltage range stays 5V for the Arduino. In this project, the source volage for the motor and the ADC is 5V so there's no problem. Since the motor draws around 300ma, I used a separate power supply. The Arudino ground is tied to the breadboard ground rail.

The stepper is a small 64:1 ratio geared motor that has two phases split in the center with the centers tied together and is connected to the +5V. The diagram shows how to connect the motor to the small board with a ULN2003 chip, which is a Darrington pair inverter with diode protection built-in. A positive pulse from the Arduino results in a ground path being supplied to one half of a coil. This correctly applies power to the motor. From the sketch, you will see I used the Stepper.h library for the program. The Steps2Take variable is set to 2048 by multipling the 32 steps/rev the motor was design to, times 64, the gear ratio, so in effect, one revolution is being commanded. Next a current reading is made and printed out on the monitor screen, then the motor reverses, and at the end of that, another current reading is made and printed.

The driver board has LEDs to show when a coil is activated. If the moter runs very fast, these are useless. You can disable them by pulling a jumper from the board. IN1 thru IN4 are as show on the wiring diagram, but have to be sequenced alternately for the proper stepping to occur (IN1, IN3, IN2, IN4) in the sketch. The Vcc and Gnd have terminals, but the label is a little confusing. The ground is on the left and the power input on the right. The extra IN signals are, of course, not used.

The current reading is set up in the hardware, so all you do is make an analgoWrite. The reading is scaled to be voltage and that is scaled to current with the formula shown. The Stepper library uses 4-step sequence. You can switch to the AccelStepper library and use 8-step sequencing. To really get to know what methods are available to you, open the Stepper.h or .cpp file and look at the methods and arguments needed.

The main reason I did this project is to experiment with the INA169 board. I want to incorporate current reading by software into the 12V and 24V supply box I built earlier. The orginal current sensors were pathetic. This one has the problem of ranging. I will probably use a relay to switch the RS resistor value to get 35ma to 3.5A range out of the device. There's the video that goes along with this project.
Click here.
Here is the sketch.



PyBoard

Py Board - the next Arduino-like Super Board


Python has become an OS

Damien George has pulled apart Python and sewn it to an ARM Cortex M4 processor on a tiny but powerful new microcontroller board called the PyBoard. There is a nice Class (like Arduino.h) that gives you access to all the M4's I/O and internal features like I2C, SPI, ADC and DACs!

PYTHON OPENS DOORS - GARAGE DOORS


I took the PyBoard and mounted it in a small plastic box to protect the SMA parts from damage. The headers were soldered in place and a couple of holes cut in the top to reach the switches on the board. The exposed pins are for four servos that can be placed in a script. The interface to your laptop is via a micro-USB port. The PyBoard comes up like a USB memory stick. Without the SD card, what you see when you open the board icon is a directory in flash with default files. One is the driver for Windows machines, a boot.py file and a main.py file. Boot.py is loaded with power-up or the reset switch. It loads the pyb Class with "import pyb" statement. Then control diverts to the main.py file. The idea is for you to copy scripts into the main.py to run. You can also divert to other files in the boot.py file to run first, but in the end, main.py will run. You can use it for clean up or just have a blank script in there.
There are four LEDs and an user switch for you to program. The second switch is the reset switch. The switches can also be used together to reach special procedures to get factory defaults or reload the boot program or MicronPython, the specialize version of regular Py3.0. The I/O can be seen here.

Since serial communication is active, just open the COM port to a terminal app and the MicroPython interpreter pops onto the console screen. You can type in typical Python staements to include the methods of the pyb Class. There are four control commands (CTRL-A thru D) to enter raw REPL, normal REPL, soft reset that runs a script, or interrupt a running program. So a typical sequence would be to open say "Removable Disk (E:)", right-click main.y and open with something like NotePad++. Then write your script and "save as" back to main.py replacing it. Then go to the terminal screen and type CTRL-D to trigger a soft reset. Your script should run. Interestingly enough the interpreter is still active. You can turn things in your program on and off, select status reading, which are a bunch of methods of the pyb Class while the program is running. Then type CTRL-C to interrupt the script and dump it out back to the interpreter. You can type CTRL-B to envoke a normal REPL on a new line. Close the terminal session. To shutdown the board, click on the disk icon and select "eject disk" to cleanly stop the USB port, and pull the USB cord.

You can place a SD card in a slot on the board and run from that. If present, the /flash directory defaults to the /SD directory, so you need to first copy the default files to your computer and load them onto the SD card before placing it in the slot. Now you have gobs of room. I had a 32G SD card available, which is overkill, but handy. Now to fully comprehend all that this little board can do you need to go to the MicroPython website.

What's going on here is the PyBoard is receiving a signal from a button through a level shifter board to take the 5Vs down to 3.3V, which is the highest level the board GPIO can take in. The response to seeing the input is an output placed on a pin to turn on an LED. This 3.3V signal is enough to turn on a channel in the ULN2003 Darrington pair chip. An LED doesn't take much current (bright 20ma), but might as well get used to the fact the PyBoard only has 3ma outputs. The ULN2003 took 0.65ma to turn on, but handles up to 500ma output. There is flyback compensation in the ULN2003, so I intend to use it exclusively with the PyBoard. This adds a lot of complexity to the circuits, but the reason this is alright with me is in the capability of using Python with a lot of onboard functionality.




Logic Gates

Abstraction - the mystery behind computing


Hardware + Code = What does it really do?

Sometimes it's good to re-look at how all this computer stuff got started, and that means getting down into the grit of digital logic, combinational logic, good old logic gates. While there, you realize that to use this technology, an abstraction of what it means has to be created. This is what led to specific hardware being pieced together to form adders, branching, comparison logic, memory addressing, and host of activities that are orchestrated using software programs to move beyond mere sequencers or "hard-wired" functionality to become a computer. To illustrate this, I made a few circuit boards you might find fun and useful. Let's look at a few.

DIGITAL LOGIC GATE POWER

Although, using an Arduino to manage circuit electronics can enhance what I'm about to describe here, most of the following concentrates on TTL or CMOS dip-package chips, which are small bundles of gated logic arranged to do specific jobs. These chips are still the backbone of prototyping electronic projects, some 40 years after EE's first started piecing together what quickly exploded into the computer age. What surprised me is the parts I first used as a young engineer are still being made in abundance and are fun for the hobbyist where most parts are sub-microscopic and hard to use. DIP packages are large enough to build up without a lot of fuss and have all the functional power you need to run some very complex projects. I yield to the fact that once you know what you want to do, using parts that compress all this logic power into small packages, like the typical microcontroller, makes a lot of sense, yet many functions are still better suited to be built up as separate running pieces of your project. Microcontrollers in conjunction with TTL logic is one step below pushing all your logic into a FPGA and placing the whole circuit inside a postage stamp sized area. Most of us can't build such tiny devices, but using DIP chips and a breadboard, we can do a lot and not loose any computing power.

To illustrate what I mean by "abstraction", I'll build a box of logic that does one thing - help a lead sheep get his flock to grass and water in time of crisis. Say what? First we have to come up with criteria that describes all the parameters of our challenge and then make a "truth table." From the truth table, the needed logic gates will emerge. We'll build the prototype breadboard to checkout the circuit, and then solder up a box to illustrate the point... "It's just a box of switches, until you the designer, abstracts to the user what it is good for." But first, we need to become familiar with the gates.

Click here for Logic Gates.

Click here for the Sheep Compass.

Click here for 555 Timers.

Click here for Hardware Debounced Switching.

Click here for Linear Feedback Shift Registers.

Click here for 7-Segment Display Drivers.




RFID Box

RFID Door Opener


Electronically open a door with a fob

Access security is not only a data problem, but access to a building also needs to be protected. Electronic enter can be a fun project. I needed to change out an old side door on my garage, so I decided to use an RFID reader to gain access.

MORE ABOUT the RFID project

From the picture on the right, you see the yellow button that's used on the inside of the door frame to open the door going out. Next is the striker plate with the solenoid latch. Then the box that can be accessed from outside the door. Notice the two LED holes and a fob. The left LED is red and is on when you approach the door. If your fob is read, the green LED on the right lights and the red goes out for the "unlatch" time, which you can see from the code is currently 2 seconds. Then on the right is the wall-wart 12VDC power supply. It not only powers the latch, but is also fed through a polarity protection diode to VIN on the Arduino board, which is regulated down to 5V for the Arduino.


The code takes a number from the ID-12 as a string over a serial interface, so we have to use the SoftwareSerial library to avoid clobbering TxRx on pins 0 and 1. Also, the heavy lifting of talking to the ID-12 reader is done by a library called ID20Reader. Here's where you can download the library Get Library. The ID-20 is the same as the ID-12, but with a larger antenna. This library has a available() and read() methods much like the normal Serial class. Here's the variable section of the code.

#include <SoftwareSerial.h>
#include <ID20Reader.h>

#define rx_pin 2 //Data input pin
#define tx_pin 3 //Unused
#define strikePlate 9
#define ledPin 8
#define unlockSeconds 2

boolean tagId = false;

String Tag1 = "2200AED6E2";
String Tag2 = "230045FE2C";

ID20Reader rfid(rx_pin, tx_pin); //Create an instance of ID20Reader.

Tag1 and Tag2 are jam-set in the code, once you know what codes are on your fobs. Take note that the hex-numbers are in caps! The reader library converts the code read by the reader to all-caps. If you miss this, the string compare will fail. Here's the setup function.

void setup() {
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
pinMode(strikePlate, OUTPUT);
digitalWrite(strikePlate, LOW);
Serial.begin(9600);
Serial.println("RFID Reader - Swipe a card ~~~~~");
}

There's nothing unusal about the initialization process. Note we can use the Serial Monitor window to capture what the fob's codes are so we can put them into running code. Here's the loop function.

void loop() {
rfid.read(); //Receive a tag from the reader if available
if (rfid.available()) //a tag has been read
{
String code = rfid.get(); //Get the tag
if (code == Tag1 || code == Tag2) {
Serial.print("Authorized tag ID ");
Serial.println(code);
unlock(); // Fire the strike plate to open the lock
} else {
Serial.println("Tag not authorized");
}
} // end of rfid read
} // end of loop()

This code is pretty straight forward with the library doing all the work in the background with the get() method. Right after the code is obtain there is a function you write called unlock(). There you can do anything you want. Here's what I did.

////// functions //////
void unlock() {
digitalWrite(ledPin, HIGH);
digitalWrite(strikePlate, HIGH);
delay(unlockSeconds * 1000);
digitalWrite(strikePlate, LOW);
digitalWrite(ledPin, LOW);
}

Once again, the code is straight forward. Here's where you set the latch open time and turn on the green LED. Notice the circuit has both LEDs wired back-to-back with one going to +5 and the other to Gnd, so depending on the ledPin value, the red LED is on when pinLED is LOW and the green LED when ledPin is HIGH. And that's it. Pretty simple. From here you can add all the bells and whistles you want.

The second video shows how I modified the Freetronics board to mount the ID12 module. I had the unit built before I shot the first video, so it was not feasible to show those deals. But the update videos shows the cut-out details and wiring. It also shows a second unit being tested mounting in a utility box.

Click here to see the video "RFID Door Opener with an Arduino Uno".
Click here to see the video "RFID Door Opener Update".




4WD Cart

4WD Cart with Ultrasonic Steering


Autonomous or BT Steering of a SainSmart Cart Kit

I purchased this kit from SainSmart as a small platform to add various sensors and not be unwieldy indoors in a small room. I built up the Wild Thumper vehicle (see project below), but it has to be taken outdoors and requires a GPS connection and software running on a laptop to coordinate moves. This small cart is a way to develop software to use BT or some other wireless comm to control a robot. This design also has an autonomous mode where the ultrasonic sensor in the front provides obstacle avoidance maneuvers.

MORE ABOUT the Cart

When you pop open the top plate, you can see the yellow colored motors. There one on each wheel, but they are wire in pairs, one pair on the left and one pair on the right side, so turns are "tank-like." In fact, using a tank tread would be a good alternative drive. The kit can with minimal information on how to hook it up or how any of the boards worked. The only wiring provided was basically useless, since it was so thin. The cable to the ultrasonic sensor was fine. It took a while to figure out where to place the Arduino Mega and there were no mounting hardware in the kit. I used nylon standoffs for the most part. The L298 H-bridge board is mounted to the bottom plate on 1/4 aluminum standoffs.


There was no servo provided in the kit, although, every YouTube video I saw of the cart had one to move the sensor side-to-side looking for the best path, and of course, that's what you want to do, so I added the servo and hacked a mounting design for the sensor.

Power is supplied by six rechargeable batteries I had around. SainSmart did provide the holder, and it becomes clear once you put the frame together that six AA batteries is the only power source that could fit. The clearance between the motors and the clearance below the servo leaves little room for a plump LiPo battery. The switch you see on the left end of the chassis applies battery power to the L298 board, which in turn supplies the Arduino via a +5V output derived from the +9V battery supply from an onboard regulator on the L298 board. That was very convenient, since the servo hookup shield sitting on top of the Arduino has a power input connector, that not only supplies the servos, but also the Arduino below without having to jury-rig wiring to the Arduino. I turn on the L298 power when loading software. You still need to have the USB connected for the serial port for troubleshooting. I place the bot on a cigar box and run the motors in place and watch the monitor screen at the same time.

Here's the shield stack that shows the USB Host Shield and the BT dongle. The wiring for the BT is internal via the SPI bus pins 10,11,12,13 that come up the pin header from the Arduino. The yellow and green wire you see come directly from the ground and +5V on the L298 motor controller board mentioned earlier. The battery voltage is regulated on that board and I brought it up to power the Arduino, which in turn powers the BT shield from this one connection point.

I added a piezo buzzer to the mix to provide beeps at appropriate times. It wired on the other side of this picture and just lays loose on the Arduino board. The software to have both a BT mode and an autonomous mode was a challenge to figure out how to switch back and forth. The hook up and software explanation can be found in the slides below. I plan to add a video of the vehicle in motion at a later date. I hope you find this project informative.

Click here for the software slides.




LCD_Pwr_Box

LCD Power Box


+12/+24V Pwr Supply Controlled via LCD Display

I needed to control two power supplies used for stepper motors or DC motor projects. I wanted to monitor the current each supply was using and maybe add a trip-point alarm. These spec items dictated using a microcontroller. I had a discarded panel with an LCD display and a 20-key keypad and a nice switch. I decided to use an Arduino Mega to handle all the I/O that was adding up. It all came together nicely, but the software was more complex than I had anticipated.

MORE ABOUT LCD_Pwr_Box

The 20-key pad posed a big problem for any Arduino due to pins required and code loading to decode the keys. I found a decode IC(74C923) boiled the pin-out down to 5 pins plus another to use for an interrupt (6 pins). The LCD display took 7 pins, because it is a 4-row device. I used 5 LEDs in the design, so that's another 5 pins. Two analog pins to read the current sensors. So you can see an Uno would not work.


Another key element to doing this project is an AC power distribution box I found in a junkyard. It controlled 4 relays via several buss protocols(Ethernet, RS232, Fiber), but the great thing is it had it's own onboard +5V supply and +12V supply to activate the relays all on one PWB. All the fancy computer stuff was on another board. I would never be able to unravel the software to run the computer board, so I chucked it and kept the relay board. It had a nice 20-pin ribbon connector that had a simple interface. Four pins went through a power buffer to activate the relays with just a +5V TTL signal. It also provided the +5V and GND from its internal supply. I used that to run the rest of the electronics. It also had a logic pin that activated a red LED. Each relay had it's own green LED that came on with the control signal(TTL) on this connector. The 4 relays control 120AC via AC sockets on the back along with the 120AC input that was switched. So I used the power in and switch, two of the AC output plugs for external equipment not part of this project, and I use the other two ACV line to power the two DC supplies(+12v and +24V), which was the point of the project.

The white perf-board in the photo was where I mounted the decoder IC, +5V/GND distribution, several caps, pots for the LCD display, and a place to distribute signals to the Arduino Mega. The front panel switch on the right side I used to boot the Arduino and send a logic ONE to pin20 or the Arduino that could be use as an interrupt for some other function yet to be determined. I discovered later that the LCD display could freeze up and needed a restart. I used this auxiliary signal for that.

Here you can see the Arduino (I later moved it to straddle the LCD like the perf-board to avoid noise spikes when the supplies came on.) and the AC plugs in the back. The small red boards are the current sensors in-line from the DC supplies. The output banana plug jacks are seen on the side of the box.

Of course, building the box was a challenge for me - not being very mechanically skilled. Work with plastic was fun. I basically got the measurements close enough to pop-rivit it together. It's a kludge for sure, but it works.

Ultimately, the output from the DC supplies come out on banana jacks shown here. The LCD have several screens that can be seen in the video. Many changes were made along the way, so the video is the last word on the screens and shows the sequence of events better than a verbal description. The physical box was odd shaped to provide a slanted face for the LCD and controls. Precise geometry is the key. I did the best I could for a garage situation, but a jig could have been made to align the parts better.

Click here to see the video.

Click here for the software slides.




Balanduino Balancing Robot

Balanduino Robot


Balancing robot a la Seqway

The Balanduino came as a kit. It is power by a 11.1V LiPo battery and can be controlled via Bluetooth.

MORE ABOUT Balanduino

The heart-brain of the Balanduino is the circuit board that contains all the electronics including an ATmega1284P CPU, motor drivers, Bluetooth, USB, IMU, and a piezo buzzer. The IMU is 3-axis of acceleration and 3-axis rate gyros. The two DC motors are geared down for high torque and each has a quadrature encoder to close the hardware loop in software. There are a couple of headers on the board so you can add sensors or drive digital I/O normally found on an Arduino that's not being used by the Balanduino. The board has a reset button and several status LEDs.


Starting at the top, the battery has been ruggedized, but I added the foam bumpers, because the Sony PS3 controller I use to drive the bot around can overspeed the bot and it will lose its balance and crash headfirst. Since it runs much better on hard surfaces, that's a problem. The Motors and PCB are tough, but LiPo batteries don't like to be whacked. If you damage a cell, it's dead. I have dropped a hefty AA size battery on a concrete floor (it rolled off a table) and it was dead. Considering the cost of these batteries, the bumper is well worth the time and hassle to put them on. The bumpers were made from a one and half inch pipe insulation tubing I bought at Home Depot.

The black rectangle next to the blue connector for the battery is the main power switch. You start with the bot on its side, power up, make sure your PS3 peers with the bot, then lift the bot up to greater than 45 degrees and the closed loop kicks in and the bot it upright. The software uses a Kalman filter to track the vertical gravity vector. The wheels drive back and forth to maintain vertical. It's pretty tight in that on a level surface it stays put. If you force the bot to move, it will return to the starting location. The encoders count steps in the move and reverse those steps back to where it came from. Of course the PS3 provides a constant error signal into the closed loop and the bot goes with that command when you want to move the bot. It turns by driving one wheel faster than the other. The joysticks on the PS3 act like tank track sticks. Push both forward or backward to go in a straight line and opposing to turn left or right.

Here is the URL for the YouTube video: Balandruino Takes First Steps




Pi-Stand

Pi-Stand


Working station for the Raspberry-Pi

This project provides a platform to develop Raspberry-Pi projects. The monitor is from a tablet device that was abandon in design freeing up this display. The keyboard and mouse are a Bluetooth combo. Since the RP only has two USB ports, I added a 7-port extension. The second USB on the Pi is where I connected the Bluetooth dongle.

MORE ABOUT Pi-Stand

The Raspberry-Pi board is attached to the back of an aluminum plate that also has the LCD display attached to the front side. The platform stand comes from a piece of aluminum I found in a junk yard with those nice arms with 45 degree angle brackets on them. It just had the look of something I could use in the future. It worked perfectly for the Pi-Stand. Notice the USB extender box on the left arm. The LCD display has two boards associated with it. The larger one mounted on the bottom plate of the stand controls the video and distributes power. The small strip I attached to the right arm is there to adjust the display parameters like brightness, color, etc.

The Ethernet cable that goes to your modem to gain access to the Internet is not shown in these photos, but it connects to the RP with its own Ethernet receptacle. The LCD, the USB box and the RP each have their own power inputs. The LCD runs on 12 volts and the USB box and RP run on 5 volts. I plan to make another board to attach to the Pi-Stand that will power all three with a LiPo battery. This way the whole stand will be portable. The keyboard/mouse combination is very convenient. You can reach the Pi-Stand with the keyboard out to about 30 feet. The Bluetooth seems to work fine.

The Raspberry-Pi uses Python as its native language. The operating system and python interpreter need to be downloaded from the Internet and placed on a SD card that is slipped into a plug on the backside of the RP board. I used the Debian Wheezy OS known as Raspbian. You need another app to get the download onto the SD card. I used the suggested program Win32DiskImager. All of this worked the first time to my surprise. The LCD comes up as a command line console as seen in the photo to the right. Raspbian is a Linux based OS, so all the Unix commands work here. The download also comes with whatever the latest version of python is that is part of the package. Mine ended up being version 3.2.3, which is now about a year old. I haven't a clue how to update that yet, but I will work on it. It would be good to keep a notebook of various processes to get things done. This is pro-level computer science to me when you have to use a command line to get everything up and running, set permissions, set up directory schemes, etc. I'm baffled that the RP was developed so children could learn how to write computer programs. Python is actually a higher level language than C/C++! The Arduino development environment is much better suited for youngsters and old dudes like myself. This is work doing all the IT bit wrangling jazz.

Once the board is all happy, it places a login line on the console. You use an ID and PW, and then command "startx" and progress to the GUI you see here with the big raspberry in the middle. Now we're talking. This is a normal desktop area where you can reach the Internet via a built in browser or the built in python IDE (integrated development environment) or editor. It's called Idle strangely enough. I haven't used it yet, but I hope it does more than sit there idle.

Anyway, that's the project so far. The Pi-Stand provides a nice compact workstation to develop programs for the RP. I hope to add a ribbon cable connection from the RP to a breadboard so I can reach my Arduino Mega/breadboard combo. Basically, the two controllers will communicate via I2C or SPI to talk to each other. Might as well stay away from the USB/TxRx ports less you cut off the ability to place a sketch on the Arduino independently of the RP. There are python modules that will provide the Arduino IDE, but it's really slow. I think I will load the Arduino first, bring up the python program on the RP and progress from there. I’ll let you know later how all this pans out.




PID Control

Balancing Ball PID Machine


Closed loop with a ultra-sonic sensor - Ball Balancing Beam

This project provides a platform to practice closed loop position, integration, derivative feedback solutions.

The sensor measures the distance to a ball sitting on the beam, which can be lifted or lowered by cam action tied to a servo motor. The servo travel is limited to the peak elevation and similar negative angle to make the ball roll back and forth.

MORE ABOUT PID Machine

The beam is a custom design with a pivot point at one end and a lift cam at the other. The various parts were selected from spare parts and happen to be close enough to do the job. The beam came from a traffic camera mount I found in a junk yard. the pivot is a couple of skate board bearing held in place with a conduit clamp. The pivot axle is a 1/4 bolt cut off to fit in the aluminum brackets I found in a junk box. Once the servo motor was mounted, the cam was drawn out to lower the end below level and raise the end by a similar amount. The cam is cut out of plastic from a old scanner bed lid. The first attempt didn't have the span needed, so an addition was added. To make it symmetrical, two copies were made and place on either side of the original cam. You and see this in the photos.

The shield on the Arduino Uno is one specifically to break out servo motors, but since all the Arduino pinout is represented, I could also use it to access a pin to read the sensor.

The software is the key. The idea is to have the sensor value be opposed to the lifting action. In other words, as the beam rises and the ball moves away from the sensor, the feedback is chosen to reverse the servo and lower the beam so the ball comes closer. A set point is selected in the software to compare to the sensor feedback providing an error signal to center or balanced the ball at a distance determined by the set point value. If done correctly, the system acts like a second order closed loop system. Now and integration and derivative blocks can be added to the loop to better shape it to respond quickly and accurately to balance the ball on the set point.

There is no video yet. It's coming though. The software will be in the slides, but I haven't had time to do those yet. But soon.




Sumo ring

Sumo - Pololu Zumo Fighting Bots


Zumo Bots - Sumo Ring Competition

This project emulates the Japanese art of Sumo wrestling with small bots.

There is an official ring you make for two bots to battle. Each bot has a max size of 10cm x 10cm.

MORE ABOUT Zumo bots

The Pololu company makes a wonderful little bot with lots of features. The best time to buy is near Christmas when the price is much more reasonable. But they do a lot. Included is a piezo speaker and extensive sound control, accelerometers to detect hits and tilts, a compass to make calibrated turns, six IR sensor in a row for detailed line following or edge detection, and a battery pack underneath. You attach your own Arduino Uno, add batteries, and then select the software from several sketches available for starters. You can customize from there. In my case, I added this IR senor and modified the code to include it.

The one at the right has an added IR sensor to see the opponent. At least that was the idea. Turns out it is only useful with a head-on trajectory. If it does see the opponent, it races to full speed. The objective of Sumo is to push your opponent out of the ring. These bots have a row of sensors behind the front blade pointing downward and can detect a line or edge. For the Sumo ring, the bots detect the white edge, stop, and reverse and/or turn to pull away from it. Randomly, they shoot across the table perchance to catch the opponent off guard and push it off the table. The head-on battles are a riot. You can't tell which one will win. They vary their speed and turning to keep a lock on the other guy.

The official ring is a 30 inch (70cm) circle painted flat black with a 1 inch (2.54cm) white edge. The table is 1 inch tall. Check out the official competitions on YouTube for Sumo robots.

Here is the URL for the YouTube video: Zumo Battles




ATX Pwr Supply

Computer Pwr Supply - Converted to Project Pwr Source


ATX Type Supplies - Intel Spec'd

Most all of these supplies are physically and electrically the same.

We can take advantage of this by placing the ATX chassis inside a standard Bud-box to preserve the AC pwr plug, fuse, and switch on the original chassis. There is a nice fan included as well. Read the Intel spec on this type of supply to get the details on how to make it work.

MORE ABOUT ATX Conversion

After reading the spec, it is clear that you have to add some sort of resister to load a keep-alive 5V supply that is sensed by the logic circuit of the ATX.

I used a 50 ohm 5 watt resister to load the keep-alive supply when the AC pwr switch is turned on. This draws 100ma, which is above the threshold to allow the main supplies to come on when the small switch on the front is turned on. The red LED comes on with the keep-alive supply and the green LED comes on when the main supplies energize. The banana jacks are ground, +5, +3.3, +12 and -12 volts. You will probably have to trim some of the many wires that come from these voltages to be able to solder a group to the jack as seen in the photo.

Now you have a +5V (among the others) to power any level of addition circuitry for your Arduino projects.
See the ATX page for more details.

Here's a second box. I call it Pwr Box 2.0, which was done the same way, but with more precision and an added fan.




Stepper Drive

Stepper Motor Drive - Bipolar


Based on L297 and L298 Chips

The L297 chip provides steering to the H-bridges in the L298 chip. It also provides current limiting control to make the system more efficient by reducing the hold current at idle and capping the current when loaded.

MORE ABOUT Motor Controller

The board was hand soldered according to information on the Texas Instruments site and the chip spec sheets.
See the Motor Driver page for details of this project.





DTMF Switcher

Use DTMF Telephone Call to Control Appliance Switches



Touch-tones from remote location turns on and off local circuits

Use a 16 button keypad to send DTMF over a phone line to be detected at the other end. The tones are decoded into a 4-bit binary code that an Arduino Uno uses to control access to eight TRIAC switches capable of switching 120V at 15 amps.

MORE ABOUT the Switcher Project

I found, before diving into this project, that telephony is more complex than one would think. Here is a list of things this project touches on:
1. Keypad decoding
2. DTMF generation
3. DTMF decoding
4. Access code schemes
5. Software to define all possible modes and combinations
6. 4-bit binary to 16-bit decimal decoding
7. Latching the switch choices after setting or un-setting a switch or group
8. Report status of which circuits were switched on or off (TRIACs)
9. Building the required DAA interface with the phone company to receive rings and go off-hook
10. How TRIAC switches work
11. Using a speech chip to talk over the telephone line and walk you through the control steps

Particulars:

Luckily there are several kits to help create a generate and decode DTMF signals.
See slides on electronics page.
Here is the URL for the YouTube video: DTMF Demo




AutoRover

Wild Thumper Vehicle - Autopilot Rover


ArduPilot on-board and Arduino based motor controller

Six wheel, each with its own motor, driven by 8Ah battery at 7.4V. Used a Spektrum DX8 RC model transmitter to drive the vehicle. Differential control for left and right by mixing the turn value with the forward or reverse value.

MORE ABOUT ArduRover

The motors have a 1:75 gear reduction, which gives the vehicle a lot of torque, but the current goes up rapidly. The battery pack is hand made consisting of six 3.7V, 2600mAh, LiPo cells stacked in two rows and three columns. Two cells are end-to-end to reach the 7.4V in each column. Total power is three times the current of just two cells alone.

Attached to the top plate of the Rover is a A8000 receiver for the DX8 and a box containing a ArduPilot, telemetry transmitter, and a 66ch GPS receiver. A lot of data is transmitted to a laptop via the telemetry channel received at the laptop via a USB dongle transceiver. The app to monitor and program the autopilot is called Mission Planner. It has a great GUI interface showing the vehicle position on a Google Map, a HUD display showing vehicle attitude, heading, and altitude. The lat-long is also displayed. This software can also calibrate the servo channels coming in from the A8000 receiver, so in addition to running a pre-determined route via waypoints, it can also be overridden using the DX8 signals.
See details of this project on the Rover Project page.
Here is the URL for the YouTube video: Rover Demo - Part 1 w/o video drive
Here is the URL for the YouTube video: Rover Demo - Part 2 w video drive





AutoRover

Ethernet Shield - Browser Control of Arduino Board


LEDs and Tone Freq Turned On and Off Remotely

This is a fun project to establish the skills to reach your Arduino from anywhere on the Internet.

MORE ABOUT Ethernet Shield

A SainSmart Ethernet Shield is placed on an Arduino Uno that matches the standard shield from Arduino. A IP address is established on a local network by your house modem/router. The router software also establishes an IP address for your Arduino board that can be reached from the WWW. The Arduino sketch issues a HTML page to a browser using this address that has command buttons on it. The commands are sent back to the Arduino via HTML FORM protocol and activate some LEDs and a tone from a speaker.

The sketch just uses outputs to the LEDs and speaker on the breadboard. The details of the sketch follow on the Ethernet Project page. The serial monitor tells you if the shield received an IP address from the router using DHCP. Then you open your router admin page and learn how to preserve the DHCP IP for the shield and what WWW address will reach the board. This is typically described as tunneling through your router. The router directs incoming traffic to a specific port, which you'll want to set up as port 80, the usual port for browsers to receive messages from the Internet.

This project was taken from Jeremy Blum's new book "Exploring Arduino" chapter 14. I highly recommend this book to provide you with many great projects to use to learn the Arduino inside-and-out.

See details of this project on the Ethernet Project page.




parts