Showing posts with label demonstration. Show all posts
Showing posts with label demonstration. Show all posts

Monday, 1 February 2016

Line Tracking Robot

While surfing around the internet one evening, I was drawn into an ad on Facebook for a product from Banggood.com. It was a video clip of a small robot following a line, a DIY kit for under ten bucks! See HERE.





While it wasn't really a good kit for a small child to do, I thought it would be fun to do it together, and great to play and explore with later too.


When I first saw it, I thought it must run on a little micro (like ATtiny), and after looking at the site, I discovered it was a set of op-amps. This helped to get me excited, mostly because I dislike this online trend where everyone just throws a microcontroller at all of their problems.

We have a few things here that I like:
Things that blink!
Things that move!
Op-amps!
Transistors!


The circuit design is simple enough, and was easy to solder together. One issue I had was that none of the kit was in English, but anyone who is into hobby electronics should be able to put this thing together without much trouble. This does seem like it is intended to be an educational kit, as it has lots of cool information about the various parts.... which I can't read, but they look good.

So basically between the pictures online and the schematic, I was able to assemble it. The motors don't come with wires already on them, I used the slack from the battery pack to make wires to go from the motor terminals to the PCB, no issues with that whatsoever.

I also had a little difficulty soldering the photo-sensor and LED's onto the board backwards, as they need to be left long and sticking out so
they're close to the surface the robot drives on. I'm not sure if a distance is specified in the instructions, but I simply left the leads as long as they could be, and it seems to work just fine like that. The tubes on the photo-sensors also appear to be heat shrink, I've just left them as they were without shrinking them, and that seems fine too.

Precision resistors are also a little different than what you may normally have. They have three digits with a multiplier behind it, so the 3.3K resistor is banded as orange orange black red (330 plus 2 zeros on the end or 33000 ohms), rather than orange orange orange (33 plus 3 zeros or 33000ohms)... geh, you'll figure it out I'm sure!
One packing issue was that all the parts were dumped into one bag together, but it did cause the op-amp to somehow get stuck inside of the spring on the battery holder. I needed to carefully remove it with a pair of tweezers. All the parts were there, and nothing was broken, but I am a fan of bags for little bits. Anyway, here are a bunch of pictures of the building process.










And that's about it! If you have any questions, type them in below. Follow the link, get a kit and have some fun. You can't put the parts together for that price tag, even if you decide to do something else with the parts, it's still a great deal. The kids liked the project and are still playing with the robot.

Monday, 20 October 2014

Hand Held A1302 Hall Effect Sensor (Gaussmeter)

This is a partial write up, I will expand on this soon. I wanted to put a schematic and code up for anyone who was interested in following up the YouTube video I posted about this!
Enjoy! PLEASE NOTE: I often add captions to correct myself or elaborate in these videos, but the text is usually only visible if you watch it on the YouTube website.

A lot of this project was inspired by this page: Cool Magnet Man This is an incredibly valuable resource if you are interested in projects involving magnets and magnetism - I strongly encourage you to read through his website, I've spent a fair amount of time enjoyably reviewing his posts.

I will apologize in advance, the code isn't amazing, the design is a little short changed - but this thing went together really quickly from concept to reality. I will likely have a software revision in the near future, if you find any bugs please let me know so I can improve the next version. This is designed to run from a 9V battery.


ARDUINO CODE:
(Some of the LCD positioning is funny because I was using an odd ball LCD for the breadboard)

#define sensorPin 0
#define calibrationPin 1

//#include <Wire.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

float sensorRead;
float calibrationRead;
float sensorPinVoltage;
float calibrationPinVoltage;
float gauss;

void setup() {
  lcd.begin(16, 2);
  lcd.print("Awesome");
  lcd.setCursor(1,1);
  lcd.print("Jarret!");
  delay (2000);
}

void loop() {

    sensorRead = analogRead(sensorPin);
    calibrationRead = analogRead(calibrationPin);
   
    if (sensorRead >= 1020 || sensorRead <= 3){
      lcd.clear();
      lcd.print ("INTENSIT"),
      lcd.setCursor(1,1);
      lcd.print("Y ERROR!");

    }
    else{
      sensorPinVoltage = ((5 * sensorRead) / 1023);
      calibrationPinVoltage = ((5 * calibrationRead) / 1023);
      gauss = ((1000 * (calibrationPinVoltage - sensorPinVoltage)) / 1.3);
      lcd.clear();
      lcd.print (gauss, DEC),
      lcd.setCursor(1,1);
      lcd.print("gauss");
    }
    delay(500);
  }


Sorry about being so blunt with this. I will elaborate more in the future.
Cheers, have fun!

Thursday, 28 August 2014

Playing with lab gear: FG-100 function generator and Leader 1020 Oscilloscope


This blog includes two videos: One where I play the FG-100 DDS Function Generator (EZM Electronics Studio) & a video where I focus on playing with the Leader 1020 20MHz Oscilloscope.

Video review and teardown of the FG-100 Function generator:
 

I found this function generator on eBay for only $32.59 USD from a Hong Kong seller, that's the final price! That price would not cover the shipping on a used lab function generator being shipped in North America. I won't repeat a lot of information that is covered in the video, but you should watch it to get a feel for how it works if you're interested in buying one. The specifications from the seller were as follows:

The main output waveform : sine wave and square-wave, triangle wave, sawtooth wave
Maximum output amplitude:± 10Vpp (no-load)
Output impedance :50Ω±10%
Dc bias: ± 10V (no-load)
Display: LCD1602
Output frequency range:
sine wave: 1Hz-500KHz
Square-wave: 1 Hz - 20kHz (the valid range)
Triangle wave :1 Hz - 20KHz (the valid range)
Sawtooth wave :1 Hz ~ 20kHz (the valid range)
Resolution :1 Hz
power supply: DC 3.5-10V

I would only put a 5VDC supply on this unit, I didn't measure the current draw, but I'd imagine it's fairly low, as you are only driving the generator, and not using it to power a load (which you shouldn't do!) - I'm not sure what the actual allowed current draw is on this thing either.
I did attach this thing to a newer digital oscilloscope with a frequency counter at one point, and the frequency was accurate to quite a few decimals, which makes me think the accuracy of the scope and the function generator were negligible at that point.
ALSO - No manual, you're on your own with this puppy, but you should be able to get it going on your own regardless.

Final Verdict: For less than $40 bucks you get something you can use to play around with, and would be fine for testing high and low pass filters, which makes it great for students or someone looking for a fairly accurate clock. If you're interested in playing with duty-cycle, it would seem you will have to do without that feature too.

The second video was me using the function generator to play around on my Leader 1020 Oscilloscope:
In this video I also play around with a capacitor and some of the features of the scope.
Manual can be found HERE.
I picked this up about 6 years ago, I think I paid a couple hundred for it, but it seems these are still being sold used for $100-200. I'm not actually sure how old this one is - It was last calibrated in 2008, and the serial number might hint that it's from 1980...
It has served me well, I wish the foot print was a little smaller, but I would rather this one than a cheap new digital oscilloscope. It's fairly easy to use, which makes it quick for most tasks. I personally find new digital scopes a little annoying at times with how many features they have and the endless possibilities for having something set up wrong (I find they also make young people lazy, they don't learn how to figure out frequency or voltages on their own).
But yeah, check out both the videos, hopefully you can decide if you want the gear I use, or perhaps you just wanted to see something or learn something.
Cheers!

Wednesday, 30 July 2014

TEA5767 FM Radio Receiver with Arduino and LM386 Amplifier Part 2


I spent the week playing around with how the radio was working, I wasn't horribly impressed with how it was working after my last post. I think I've pretty much nailed it for what I want to do, I even fixed a few kinks. I do strongly recommend you check out the post behind this one to see links to where software and design material came from. I also mentioned that the way I mounted the TEA5767 was similar to what another individual did, and here is a link to his blog: http://www.doctormonk.com/2012/03/tea5767-fm-radio-breakout-board-for.html

I've also noticed that this posting has been receiving a lot of attention, and I decided it may not provide enough information for someone trying to replicate it, so I made a quick and dirty paintbrush schematic:
For both pots I used a single turn 10K potentiometer.  You should also tie up the SDA and SCL lines up to 5V with a 4.7K resistor - this module seems to work just fine without it.
I understand the schematic isn't great and should be a CAD drawing, but it's simple enough. I'd urge you to dig up the data sheet for the LM386 to look at the different configurations. Hopefully this schematic will make this post more useful! This is a component of a larger project I'm working on, so hopefully at some point I will have it drawn properly in its entirety.

Because of how mine is done, this will be a daughter board soldered onto a main perf. board.

I'll make a programming note here:
You can see in the picture that I soldered onto the middle pin on the right side of the chip, which is suppose to be LEFT CHANNEL. If you decide you want to mute the RIGHT CHANNEL by adjusting the 3rd byte, they are backwards - you will end up muting the wrong one!! I'm not sure if  the issue is that you're turning off the wrong channel, or if the pins are flipped - if you're running stereo, this could mean you have LEFT AND RIGHT backwards. If you're running mono, like I am here, it won't matter - but I feel this is a fairly large ooops in a data sheet.

One thing I really didn't like about how my first attempt worked was that tuning with a 270 degree potentiometer was horrible. It just doesn't have enough resolution - if you actually tuned the channel you wanted, it would weave in and out of it, making it pretty intolerable. The solution I came up with (and this is really because I wanted to keep the number of knobs and buttons to a minimum) was to use the ADC to use different areas of the knob to achieve different results.

To the left you can see the scheme I used to control the tuning. It was a little weird at first, but I seem to have gotten the hang of it. If the knob is pointed up, nothing happens. Turn it a little to the left and it decreases by 100KHz, Turn it further, it decreases by 1MHz. It's buffered by a 300ms delay, which you could tweak to your tastes. I'm not in love with it, but it seems to work well for using the materials I have and getting it to tune in a satisfactory way. I will likely use the same method for setting the time on the clock portion of this project.

Here is what some of  you may have been skimming for, the code:

#include <Wire.h>

unsigned char frequencyH;
unsigned char frequencyL;

unsigned int frequencyB;
double frequency;
double tunerFrequency;

void setup()
{
  Wire.begin();
  frequency = 95.9; //A fancier approach would be to store this in EEPROM and retrieve last channel ;)
  Serial.begin(9600);
  setFrequency();
}

void loop()
{
  int reading = analogRead(0);
  //Serial.println(reading); //Shows the adc position - setting it to 512 will point "up" so you can attach a knob
  if (reading <= 410 || reading >= 614) checkTuner(); //only check tuning if tuning knob leaves rest area
}

void checkTuner()
{
  int currentReading = analogRead(0);
  if (currentReading <= 205) frequency = frequency--; //Tune back by 1MHz
  else if (currentReading >= 206 && currentReading <= 410) frequency = frequency - 0.1; //Tune back decimal
  else if (currentReading >= 614 && currentReading <= 819) frequency = frequency + 0.1; //Tune forward decimal
  else if (currentReading >= 820) frequency = frequency ++; //Tune forward by 1MHz
  else frequency = frequency; //If something unexpected happens, this will buffer it out
  if (frequency < 88.0) frequency = 88.0; //make sure it doesn't tune too low *Band limits can be adjusted
  if (frequency > 108.0) frequency = 108.0; //make sure it doesn't tune too high
  delay(300);// this delay will only occur if the main loop makes it into this function
  Serial.println(frequency);//only prints frequency while being tuned
  setFrequency();
}

void setFrequency()
{
  tunerFrequency = ((int)(frequency * 10)) / 10.0; //fun use of a cast!
  frequencyB = 4 * (tunerFrequency * 1000000 + 225000) / 32768;
  frequencyH = frequencyB >> 8;
  frequencyL = frequencyB;
  Wire.beginTransmission(0x60);
  Wire.write(frequencyH);
  Wire.write(frequencyL);
  Wire.write(0x1A);//0001 1010 -highside injection, forced mono, "right channel" muted, *PINOUT AND 3RD BYTE HAVE CHANNELS SWAPPED
  Wire.write(0x10);//Set for US and Europe band
  Wire.write(0x00);
  Wire.endTransmission();
}


I won't take credit for this in its entirety, between the link I posted above and a blog mentioned in the previous post, is where some of the work came from. You will want to open the serial monitor window in your Arduino IDE to see the frequency. I implemented my tuning method in the checkTuner function. I also tweeked out the setFrequency function, it seems to have fixed an issue I was having with the tuning drifting by 0.1MHz (I don't know why). I also changed that it only sends a message out to the I2C bus only after a change is requested by the checkTuner function - I was getting a ticking sound from it constantly communicating ~200ms. So I have it tuning better and less clicking. I also adjusted some of the data bytes to better reflect my needs. I found a detailed data sheet here:
http://www.voti.nl/docs/TEA5767.pdf 

The one last issue I had was trying to get it to scan for channels. I never got it to work properly, if you have it sorted out, let me know! 

So yeah, check out the video for the demonstration, and stay tuned to see where this project ends up. I hope this helped if you were looking for guidance!

If you want to see this project with a real time clockadded to it, check out a more recent blog which uses the DS3231 RTC combined with the project you just read about here: Arduino + DS3231 Real Time Clock

Monday, 21 July 2014

TEA5767 FM Radio Receiver with Arduino and LM386 Amplifier

Moving along with the clock radio project, I made a hardware prototype of the radio component!

Here is the YouTube video that gives a quick demonstration and a quick overview:

See the second post on this topic for diagram and improved code: TEA5767 FM Radio Receiver with Arduino Part TWO

Basically, the goal of this was to get a radio module to work with a microcontroller, and also decide on the amplifier configuration. In the video you can see it hooked up to a small 8 ohm speaker, and it sounds decent - and it will sound better once it is in an enclosure.

I purchased new potentiometers, the TEA5767 modules and the LM386 amplifiers off of eBay. Waiting for the components is a little frustrating, however the venders in China are low cost and very friendly - I've only ever had one issue, and it was the mail systems fault.





The most difficult stage of the project was trying to get the TEA5767 module to be useable. It is really really small. Don't order just one of these, you will likely make a mistake - I bought two of them for less than $4.00.





Attaching wires to this was tricky. This was my first attempt. in the bottom left, you can see a surface mount component is missing.. while attaching the wire with a soldering iron, I accidentally had solder run up onto the board and the component started to float - it was way too small to re-attach. The device no longer functions correctly, maybe I'll try to figure out what the component was at some point and fix it, but for less than two bucks, I'll let it go. Another issues I had, and this happened on both my modules, the bottom right pin is VCC, and I accidentally bridged it to the case of the crystal, which caused a short - easily fixed.

The second attempt was a little more involved, but yielded much better results! I used a scrap of protoboard and some pin headers to hold the chip. This technique was very similar to what I think I say someone else do while I was looking around on Google (I forget where). Basically, I just used a small piece of wire and threaded it through and pushed it against the side of the board and I soldered it from the side so I wouldn't damage components. I pushed the plastic down on the pin headers to get as much length as possible on the pins and dripped the header in. The wires are tacked onto the pins on the backside NOTE: You will need a clamp of some sort to dissipate heat when soldering the wires to the pins, as the heat will otherwise separate your wire from the side of the chip (I used a set of self clamping tweezers). One of the reasons why my breadboard was such a mess was because it was built to hold my first attempt, and the 2nd attempt didn't fit quite so nicely.
The first attempt would have taken less space, the second attempt didn't fit on the breadboard very well. Since I only had two of these, this will be how the module exists in my final clock project.
Most of the information I gathered on using the TEA5767 with an Arduino was on another blog:
http://www.electronicsblog.net/arduino-fm-receiver-with-tea5767/
This blog contains lots of information, including some information from the datasheet, it's highly readable!


Also on the breadboard is the LM386 amplifier. The speaker and amplifier circuit are all running off of the 5v rail on the Arduino board, which also goes to show how little power this takes. The schematic I used I found on another blog, Hack A Week, which I follow on YouTube regularly. His LM386 blog is found here:
http://hackaweek.com/hacks/?p=131
The schematic shows a 10uf capacitor to optionally increase gain, this circuit had plenty of overhead without it, so I didn't include it. I did the "bass boost" filter, but used 0.047uf rather than 0.033uf - I personally liked the sound more.



Here is a picture of on of my Arduino development boards for fun. You can see I'm only using a few wires. The Arduino had two wires supplying power to the breadboard, 2 wires for the I2C and one wire to receive ADC (analog to digital data) from the potentiometer being used as the tuner.



So yeah, watch the video at the top to see what's going on here. In the near future, I hope to have the tubes soldered onto a board so I can start moving ahead with the build. I have a few concerns about trying to multiplex 6 tubes with the same microcontroller that is running devices on an I2C bus, I might use two...  I don't know, we'll see. But anyway, cheers!

Here's a picture of what this project is doing to my poor workbench. A mess is a sign of genius, right?
Good luck with your project!

Friday, 11 July 2014

Superheterodyne Shortwave Receiver



This will be a very short post showcasing a Telecommunications project that I completed for school. I'm reluctant to share any of the specs, as the circuit board and specifications were developed by one of the faculty at the school, and I don't really feel that they are mine to share. BUT, feel free to take a look at it!



This entire project is based around the TDA1572 IC, which is an older chip designed for AM radio receivers. In this project, the radio is tuned to function between ~ 9-12MHz. It does work well, and late at night I can listen to international transmissions! I'm listening to China Radio International while writing this! It also feature an MPF102 JFET and an LM386 OPAMP for the amplification of the signal. It also has 3 hand wound toroids.

The electronics are housed in this cigar box, which at one point contained 25 Luis Martinez Ashcroft Corona cigars (A year in the humidor and they really have a nice medium taste, I like them with a drink of wine or Scotch at night). This was the perfect size for this radio project. Buy your box here!







This view is to show off the speaker. It's a clear plastic waterproof speaker I picked up at the surplus store, I may replace it later, but it works fine. On the bottom left you can see a banana terminal, which I'm using to insert the antenna. Currently I'm using a length of scrap clothes line which works very well. I clip the antenna to my clothes line and reel it out, which works great for a temporary whip antenna, it's about 35'. A longer antenna would be better for this radio, but it works quite well!


While I was making my youtube video, my cat decided to come help.








Here is a picture of the guts. The board was created for a class to use, which included instructions. The TDA1572 was an SMD chip chip soldered on its own board, then that board was soldered using headers to the main board.
A lot of the schematic can be found on the data sheets provided by the futurlec website, the data sheet is very detailed, and has lots of room for deciding how you want to build your radio!
You can can also see the potentiometers I hot glued in (the box was too thick to set the nut). The potentiometers are for volume, fine tune, coarse tune. You can also see a few marrettes, which are used to connect the wallwart to the board. The board has a 7805 regulator.

For a handmade project, I think it looks pretty slick!

Okay, so what's this superheterodyne talk about? The TDA1572 IC allows for a lot of the work to be integrated into one chip. In most hobby radios, or super old radios, a system called RTF (Radio Tuned Frequency) is used, which usually uses a ferrite road wound with a given number of turns of magnet wire, and a costly variable capacitor, which then resonates with the desired frequency, and that signal is amplified. The superheterodyne takes a signal and brings it down to the IF (intermediate frequency) or "working frequency" and then does its work. This chip requires relatively few components for what it is doing!

If you are interested in the work being done on the signal in a superheterodyne receiver, check out the wikipedia page, it is very descriptive and well written.
I am very impressed with how radio has progressed. I intend to build an FM receiver into my next project, and the number of external components is almost none! That project will just drop the FM IC onto an I2C bus, and away it goes. I do think in the future I will pick up a vintage radio and claim the parts to build an RTF style receiver that goes even lower down so I can explore some of the transmissions happening further down, but that might be a while before that happens...

Anyway, for anyone who is interested, I'm still working on my IV-9 clock, and very recently I made the small step of getting my two tube counter to work on a PIC18F44K22! Which I plan on the final clock radio to run entirely on one PIC18F45K22 microcontroller. I'm still toying with it, hopefully I'll have a 6 tube board going soon.
 Here are the two tubes displaying 27, while you can see it toggling between the two tubes on the scope. I had a few issues with the software going from Arduino to Microchip, but yeah, works fine.


Anyway, cheers, have a good one!