Sunday


JunkBot Line Follower 
Physical: 

The JunkBot has been slightly updated with a larger platform, and I replaced the h-bridge with a motor driver module. This was done for simplicity, size, and just to test it out. The code did not have to change since they are driven in the same manner. 

The line following 'sensor' uses a laser and two IR sensors to detect the line. Variable resistors are used to set the sensitivity of the sensors. I chose to use a laser since I had one on hand and it is capable of overwhelming ambient light sources. My initial design used an LED, which worked almost as well. I removed the lense from the laser, making the width of the beam wider than the strip of tape. The IR detectors are mounted just below the laser, and the beam passes between them and reflects off the floor. The detectors are shielded with black electrical tape.

 














  




Logical:

Fairly simple code, the value of each IR detector is read into an analog input, and motor speed is tied directly to these values. When line is between the detectors, slight adjustments are made. When line is out of these boundaries, more aggressive adjustments are made.

Written using the Arduino IDE, running on Arduino Nano/ATmega328

JunkBotX_SD_LF preliminary code here (Current code for testing, all other functions disabled)

Functionality:

Put together mostly out of curiosity, it follows lines in a fairly smooth way without diverting from the defined course. Could be fine tuned for smoother or more precise adjustments if required. This may be useful in repositioning or determining location based on visible markings.



Arduino / XBox V1 RF(Wireless) Controller Hack:














                                                 




Physical:

The above pictures show the process of installing an Arduino Nano into a generic wireless Xbox V1 controller and wiring it up. I removed the vibrating motors, chopped the circuit board, and added my own transmitter (visible on top-left of controller). I also chopped a hole for USB connection and transmitter wires which will be shortened. (315Mhz RF module using VirtualWire)

If you look close you will see that the wiring could have been laid out much better and arranged in more of a logical way. I didn't plan on using all the buttons and d-pad, but once I got started, I couldn't leave all those unused pins and buttons. It was also bit of a rush job as usual.

The joysticks work by using 2 potentiometers each as shown in the above pics (Orange), and the triggers use just one. All I had to do was scratch out the connections on the circuit board and wire up my own. I also chopped the circuit board in half to make more room for the Arduino. I currently have both joysticks, the d-pad, triggers and A-B-X-Y buttons all functioning. (uses 6 analog and 8 digital pins). Built in LED indicator is wired to pin 13.

I am not posting a schematic for this since it is pretty straight-forward, but here are some basic steps:

1. First off, the 'outputs' on the controller itself are just potentiometers and buttons. They get wired to the Arduino in the same way as any potentiometer or button.
2. Connect the center of each pot to an analog input
3. Connect each button to a digital input.
4. Leave all ground connections in place
5. Scratch out + connections and wire your own to 5v on Arduino. Use resistors built into controller where possible, otherwise include where required.
6. Adjust input pins in source code as necessary.

The only complicated part is the number of wires to connect and fit in there.

Logical:

The controller starts by determining the zero-point or center area of the joysticks. Any slight movements in this area will be equal to zero movement. Movements outside this area will be measured by the analog inputs reading two potentiometers per joystick. Triggers are measured by analog inputs reading one potentiometer per trigger. All joystick movements/variables are sent as 1 byte each, in a single transmission, multiple times per second. Triggers are the same.

Source code for controller here  (Only transmits trigger and joystick movements currently)

A complete rewrite of JunkBot code seemed in order, since controlling it with a proper controller and coding it differently could simplify things greatly. That is in progress, but movement is pretty much done:

Basic JunkBotX source here  (comment out SD card initialization if not hooked up)

UPDATE:

JunkBotX_SD source (working code, but in progress) here
- SD Card logging of movements
- fwd/rvs playback

Controller Source to accommodate record/playback  (B and Y buttons) here

AutoAnalogAudio Library - nRF52 Now supports Successive Approximation Analog-to-Digital Converter for Audio Input

 AutoAnalogAudio Library - nRF52 Now supports SAADC Support for Successive Approximation Analog-to-Digital Converter for Audio Input I'v...