Sunday, June 1, 2014

Where to Start! FPGA, PSOC?

Ok, so I was looking at some kickstarter campaigns again. And came across this:
https://www.kickstarter.com/projects/13588168/papilio-duo-drag-and-drop-fpga-circuit-lab-for-mak

I read it, and thought, wow, that's pretty neat.
And so I had to find out more.
So if you don't already know a FPGA is a Field-programmable gate array. And the way I understand it (which isn't that much really) IS it's all digital, and it's all logic based like on AND, OR, NOT gates, but using these you can "build" timers, switches, computers, and just about anything that uses logic gates. They are on a signal chip, or sometimes a couple of chips.

Well, that is really all I know about these, they sound completely amazing, and I'm wondering just what they really can do if there were millions of them together (Yup, I'm thinking of building Data, come on I can't be the only one who has thought this).

Anyways, FPGA are made by a few different companys, Xilinx, Altera, Lattice, Actel, Achronix, and that is just a few.
The Papilio uses a Spartan 6.

OK, good so far right? These devices seem to be all over the place in price, I've found a few Altera boards on ebay for as little as $15 bucks from China. But typically the prices seem to sit around $45 to ???? (Yup I've seen a few board that go into the 4 digitals a few, very few, but they are out there)

And other then finding boards and manufacturers, I'm really no more along to understanding how to use or program these boards. Speaking of programming,
some of the boards seem to use JTAG, some FTDI (Serial), some "emulate" either JTAG or FTDI using USB.
They all seem to use VHDL or Verilog (or a combination of the two), it also seems that each board manufacture may or may not have a variation of VHDL or use it's own IDE.

There are some but not many tutorials on how to use these, Papilio does have a descent amount of tutorials. So I have been leaning toward one of those boards, but it's hard to make a descision with out a whole lot of information.

 Cost isn't the only factor here, how ever it is a big factor, so a lower cost board that is just as capable as it's pricey brothers would be better. 

Here is what I found, and what I don't understand:
Papilio One 250K - $38 marked down from $50 - Ok I get it doesn't have much ram I guess IS that important for one of these? OR is it all about the processor? and is processor even the right word for these?
Processor: Xlinx XC3S250E and 4Mbit SPI Flash memory
easy introduction to FPGA, digital electronics, and system on a chip design
easily add new functionality with wings that snap onto the board (OK? So these are like Arduino shields from what I gather, and seem to only be offered from Papilio and only work on Papilio - Appears the Papillios don't have anything on board other then just what they need to work)
Two-Channel USB connection for JTAG and Serial Communications (OK does this mean I don't need a JTAG programmer? it's not real clear, but I'm assuming that the board is USB/JTAG emulation)
Four independent power rails at 5v, 3.3v, 2.5v, and 1.2v Ok this might come in handy for something
Power supplied by a power connector or USB
Input Voltage (recommended) 6.5 to 15v (IT doesn't say, but I'm pretty sure this has to be DC)
48 I/O lines
Papilio One 500K - $65 marked down from $80 - Big price dereference here and I'm not sure what the real differences are. So lets look:
Processor: Xlinx XC3S500E and 4Mbit SPI flash memory (Ok, so it's a different processor, but is it better or worse, I don't know I don't have enough info)

Everything else looks like it's the same as above.

 Papilio Pro - $85 marked down from $100, but this looks like a very different board to me.
Processor: Spartan 6 LX8 FPGA
high efficiency LTC3419 step down dual voltage regulator
dual channel FTDI FT2232 USB 2.0 Full speed interface
64MBit micron MT48LC4M16 SPI Flash
48 I/O pins arranged in a Papilio Wing form factor
32mhz crystal oscillator

I don't know if this is good or bad for this board, I really don't understand what it can or can't do, and I don't know why it's different from the other two boards.

Papilio also has that kickstarter campaign running.

So a couple of other boards I was looking at:

 Elbert V2 - Spartan 3A FPGA development board.
Spartan XC3S50A in TQG144 package (Similar boar as the Papilio 50K?)

16Mb SPI flash memory, USB 2.0 interface for on-board flash programming, FPGA configuration via JTAG and USB.
8 LEDs, Six Push Buttons and 8 way DIP switch for user defined application,
VGA output, stereo audio out, Micro SD card adapter, three seven segment displays, 39 I/O lines, on-board voltage regulators for single power rail operation.

OK,  I didn't tell you the price for all this: $30 bucks.


The Numato Labs website looks like it has the information for this board, but doesn't really look like it has a tutorial for using FPGA - So that leaves the question will any tutorial work (IE: the one from Papilio?) Will any software work, IE: if I want to use the pac-man game from papilio will it work on this board?

I'm thinking this board is better in a lot of ways and worse in some other ways.

Cost wise, seems to be better (but maybe not, I don't know enough to know if I'm looking at an old processor or what)
But it does have a lot of "extras" on board, is all that needed? I would have to say yes and no, and here's why. IF you aren't going to use the 7 segment display it's just taking up room that could be used for something you are going to use.
BUT on the other hand you don't have to buy anything extra to get something useful working right out of the box either.
Papilio has what they call wings, including some "mega-wings", Wings seem to range anywhere from a $5 - 8 dollars to $15 - $20 dollars,
"mega-wings" on the other hand seem to go from $25 to $150 dollars, I will say thou they do have a megawing arcade system that is very reasonable price
The nice thing about Papilio is if you don't need it you don't pay for it, but it ends up costing more in the long term.
Elbert V2 vs The Papilio boards:
Elbert 39 I/O pins - Papilio 48 I/O pins - ok I think this is probably a toss up, you lose 9 pins with the Elbert, but if you add any wings to the papilio you lose pins (and you'll almost certainly have to add things to the Papilio to make it useful)


As I sit and write this document, I am starting to wonder if the Elbert wouldn't be the board to buy. Then again I don't have enough information

But you've made it this far, and so have I - My title said FPGA and PSOC!
Let's talk about PSOC so while I was trying to find out more and FPGA I came across the Cypress CY8CKIT-042 PSoC 4 Pioneer Kit - only $25 bucks
Like FPGA there appears to be a lot of different types of PSoc controllers, unlike FPGA Cypress seems to be the only one who makes them. I kind of take that back, there is something call FreeSoc (But I think Cypress still makes the chip for that project)

So PSoC is Programmable System on Chip, and they are "mixed-signal" arrays, and there is a micro controller that controls the array I guess, I'm not sure how they work. Supposedly these are easier to learn how to use if you only have a micro-controller background.
These can do both analog and digital I/O. From what I gather they are similar to FPGA but are very different to use

So I don't know where to get started in something that is more then a  micro-controller, and less then "Commander Data", but might get me a "Data" one day.

The way either sound it sounds like fun times, and a great chance to learn something new.

Any helpful info would be - well helpful!

Wednesday, January 29, 2014

Robot's of the Future are based on Apple II computers! WOW!!!!!!

After seeing this blog: Terminator: Do Robots Think in Apple II source code http://mentalfloss.com/article/15832/terminator-do-robots-think-apple-ii-source-code I got to think about it, and I saw another robot that must at least think in Apple II source code - at least his processor would support that idea.
Of course you all know the Apple II has a MOS 6502 processor right, so I think all robots in the future must be made from our old Apple II machines.... :-)

Wednesday, September 19, 2012

The Robot Project!

It's Sep 19, 2012 - And it's been about 2 months since I started turning an electric chariot (A FAKE Segway) into a robot, this project started out to be a robotic lawn mower, and since it was started I got a real robot lawn mower, so I don't think I want to make this into one any more. I'm not really sure what it will become, but I thought it's been long enough and lots of stuff have happened I felt I needed to document the journey. So this is what I used as the base, mine was blue, and a slightly different model, but they are all pretty much the same. One of the first things that I wanted to do was do a tear down of the chariot and find out just what I was looking at to use. So below is the motor controller, made in China, but that is really about all we were able to find out about it, It's a single controller, but drives both wheels (I should that both wheels do the same thing, in other words, forward drives both wheels forward. there is no left or right control) With that being said, you can see the large relay in the middle, that is used for reverse, and to turn one or the other wheels off. Unfortunately, there is no way to make one wheel go forward and the other to go backward, at least with this controller. The wheels themselfs are the motors, simple 36v DC motor, they are regenerative motors, and it looked like they are setup to feed back into the battery if the break is engaged. Speaking of break, the motor control does have a full stuff electric break, which worked really well, almost too well when there is no weight on the frame. So here is the frame with the motors/wheels, and after I removed the steering off the back wheels and made them free spin (360 degree). And there are 2 or 3 videos of me getting the wheels working with out the "controls" that it came with, really it's a lot of simple switches, So I decided to go ahead and use the controller that it came with, and I wanted to keep the project "cheap" There are also a couple of video showing how I figured out how it did turn one or the other wheels on or off, if one of the wheels is off it becomes a free wheel, and depending on the surface it's sitting on depends on just how much that wheel turns My controller of choice was/is the Parallax Basic Stamp, If you go back and look at some of my video, you can see me playing around with the Stamp, it's easy to use, fairly low cost, and if used in quite a few robots, I also ordered a few arduino relays (12 total, even thou I really only need 6) These are coming from China, cost wise they were very cheap, time wise, they did take a while to get here. And I got extras because what if one failed, I would have to wait again for a replacement, no I have a replacement. Meanwhile I started to program the stamp, and do a basic lay-out of what and where things should be hooked up. The picture below shows the relays and the stamp on a board on the frame of the chariot. It was about this time thou that I came across an Ambrogio robotic lawn mower, and that is when this changed from a lawn mower to just a really cool robot to play with! In the picture above you can see the relays, (3 of which are no being using, more on this later), the basic stamp board, and a 2nd breadboard - the 2nd breadboard has a LM358A Dual Operational Amplifier, this when using a Pulse Width modulation signal from the stamp can be used to generate 5v which is used then to drive the motor controller - 5v will give max speed, the PWM can be adjusted and various voltages come out, 0v volt = stop, and anything between 0 to 5 will control the speed of the wheels. At this point, the LM358A circuit didn't work, and we finally decided that it really did need 12v like the diagram said it did, We did end up destroying one side of the Op Amp as well. A ping sensor was also added at some point with in this time frame. and a simple real word test was done, at this time I was using a weak battery, but was doing a test, things seemed to work, more or less, but once I put a good main battery on it - it was way too fast. During this test thou I decided that I might need to add a servo for the ping sensor to move, and get better detection. We also added some Voltage regulators at this time, a 12v, 9v and 5v were all added. The LM358A was placed on it's own breadboard, and piece of wood, it was mounted behind the stamp (Unfortunately I can't find any pictures of this, thou there are some videos with it in this configuration), Also mounted the USB connector for the stamp, and using a USB extension cable to program it now. At some point, we decided that we also needed more amperes to power everything, both the 9v and later the 5v had transistors added to them for just that reason. This ended up causing hugh problems thou, what my partner didn't realize is that the transistor where grounding out on one of the positive pins, And we went though many burt wires, and lots of archs and sparks. It took almost a week to get it back to "normal", and I ended up doing an almost complete rebuild. At one point I did think I fried the basic stamp board, but luckily it is working just fine. The above video was just after the rebuild. This was also after a rebuild, during the time of all the archs and sparks I beleive we ending up rebuilding this twice or more, I did move things around more thou, not really a complete rebuild. The above video shows a wheel/bench test this is after I got LM358A working, and again I moved some stuff around, removed the servo at this point, but later I moved the ping sensor again and put the servo back on. it was about this time that my Parallax LCD showed up, the LCD has backlight and speaker, this added the many possibility And my ADC0831 analog to digital converter showed up, and a very simple voltage meter was added, using a simple voltage divider. This was also the 2nd time during this project that I blow something up...Its a good thing I ordered two ADC0831, they really don't like having 36v applied to the input. I also mounted the LCD, and moved the board from behind the stamp, to ontop of the Stamp (For like a two layered effect), moved the Ping Sensor and added the servo again. I was having some issues with the servo, I thought it was a power issue, but turns out the basic stamp just didn't like a 25+ year old analog servo. At this point however I didn't fix that problem and just disconnected the servo again. I wrote some code for playing a "Battery Dead" and "Unknown Error" sounds using the LCD, and put those sounds into the robot code. About this time, My IR Obstacle Avoidance sensors showed up from China, I haven't added these into the bot yet, I did test them, they work great, are very simple on off switches (If it sees nothing it's on, if it sees something it's off, or is it just the opposite?) Either way I wrote some code, and I am planning on using these from drop off sensors, and yes they did work outside, quite happy with the results, but still need to get them mounted. Which finally brings us up to about last week, I added a Basic Micro Nano8 processor to control the servo, I setup the Stamp to send a high to the Nano8 when the Stamp wants the servo to move, the Nano8 is just will move the stamp to one of three spots, -45 degree, 90 degree, and 45 degree. It just counts the number of highs/low and decides where to move the servo, there is no feedback to the Stamp, the timing on this is a little off, but this is kind of a work in progress and it does work. The Nano8 has 4 I/O lines plus a serial port, the 4 I/O lines can be used for A2D, and 1 of the lines is capable of doing PWM. I have two analog sensors ordered a temperature and a humidity. I also order a couple of serial port buffers so the Nano8 can send the sensor information the Stamp, and the Stamp can decide what to do with it. But for now the Nano8 is only controlling the servo, added the Nano8 appears to have fixed the bouncing issue I was having using this servo with the Stamp. Of course this is still very much a work in progress, I have several things ordered that haven't arrived yet, an accelerometer, humidity and temp sensors. I did order a smaller relay board, and they arrived today, so I am going to replace one of the relay boards with the smaller board. I still need to figure out away to contain it within the yard, and work on getting better speed out of the wheels, or maybe just one speed at this point? Reverse goes at almost full speed, while forward is going to be very slow. I have a lot of videos of the progress on this, alot more then I posted here. http://www.youtube.com/kd8bxp That brings the project current as of Sept 19, 2012, I'll be doing more posts as it progresses, and of course a lot more videos to come! LeRoy, KD8BXP

Sunday, June 24, 2012

Controling the Kenwood TH-D7 from a PHP script

I was asked to write a blog post about the TH-D7 PHP script I wrote and posted about on twitter and youtube. One thing, all of my scripts were and are written for the command line, thou I see no reason why you couldn't use this script from a website, maybe with some slight modifications. You'll need to get the php_serial.class.php written by Rem Sanchez It can be found here: http://www.phpclasses.org/browse/file/17926.html This php script is the key to making the whole thing work, well at least it's one of the keys. The other the D7 and other Kenwood radios can be controlled from the serial port on the radio, you just need to know what to send to the port for the radio to do what needs to be done. For the command protocol you should look here: http://www.radiohound.com/command.htm So the basics: 1 include the php_serial.class.php 2 open the com port 3 send the command to the radio 4 Jump up and down because it worked! LOL It really is as simple as that thou. So, let look at my code, which is still very much a work in progress, sooner or later I will add/change the code so that it will ask the Freq or ask the message, at this time, it's hard written in the code, but it will give you an idea. CODE: D7.PHP require("php_serial.class.php"); $update = toserial($msg, "/dev/ttyUSB0"); function toserial($text, $comport) { //Initialize the class $serial = new phpSerial(); //Specify the serial port to use... in this case COM1 $serial->deviceSet($comport); //Set the serial port parameters. The documentation says 9600 8-N-1, so $serial->confBaudRate(9600); //Baud rate: 9600 $serial->confParity("none"); //Parity (this is the "N" in "8-N-1") $serial->confCharacterLength(8); //Character length (this is the "8" in "8-N-1") $serial->confStopBits(1); //Stop bits (this is the "1" in "8-N-1") $serial->confFlowControl("none");//Device does not support flow control of any kind, $serial->deviceOpen(); $serial->sendMessage($text); $serial->deviceClose(); return; } The above is will be called from the other scripts, it's meant to try and keep all the scripts small and easy to use, mainly what this script does is setup and send the command to the serial port. My FREQCHANGE.PHP $freq = '00144390000'; $msg = "FQ " . $freq . ",00" .chr(13) .chr(10); include ('d7.php'); OK, so here I set what Frequency I want to change to, you might notice how the frequency has leading zeros and trailing zeros, this is required by the radio, otherwise it's not going to work correctly. The $msg is what is passed to the D7.PHP script and is the command for the radio so if we look at the command protocol we will see that FQ is for setting the frequence and is in the form of FQ(space)FREQ,00 and a return and line feed need to both be sent I have two scripts setup for turning on and off the TNC of the radio as well, they are pretty much the same script: $msg = "TNC 1" .chr(13) .chr(10); //will turn TNC on $msg = "TNC 0" . chr(13) .chr(10); //will turn TNC off But again I refereed to the command protocol for those commands :-) of course the fun command is to send an APRS message! For that I wrote a short PHP script called: APRSMSGSEND.PHP $tocall = 'CALLSIGN-SSID'; $tomsg = 'Testing APRS Msg via script'; $msg = "AMSG 00," .$tocall . "," . $tomsg . chr(13) . chr(10); include ('d7.php'); SO as you can probably see by now, it's just setting the correct command to send to the serial port of the D7 $tocall call be a callsign or a callsign with SSID, and just remember the D7 is limited in how many characters it can send for the message SO, really the key to make this work is the serial port script! The D7 has a lot of other things that can be controlled via the serial port so I will refer you to the command protocol. My scripts are still very much a work in progress. Sooner or later I would like to make it look for key words off twitter probably just to change the freq, and I'll hook the audio up to a streaming service so people can listen in! :-) Other radios probably can also be controlled by this method as well, you just need to know the command protocol for your radio! Happy Radioing, and 73, LeRoy, KD8BXP

Thursday, March 15, 2012

How I did the Knight Rider Style LED Chaser using the basic stamp

So I was asked how I did the cyclon/knight rider stlye chasing LEDs using the basic stamp.
These two videos pretty much explain it, but I also said I would post the code, so here it is.






Cylon Chaser Lights:

' {$STAMP BS2}
' {$PBASIC 2.5}

HIGH 0
HIGH 1
HIGH 2
HIGH 3
HIGH 4
HIGH 5
HIGH 6
HIGH 7
HIGH 8
HIGH 9
PAUSE 500
LOW 0
LOW 1
LOW 2
LOW 3
LOW 4
LOW 5
LOW 6
LOW 7
LOW 8
LOW 9
DO

HIGH 0
HIGH 9
PAUSE 50
LOW 0
LOW 9
HIGH 1
HIGH 8
PAUSE 50
LOW 1
LOW 8
HIGH 2
HIGH 7
PAUSE 50
LOW 2
LOW 7
HIGH 3
HIGH 6
PAUSE 50
LOW 3
LOW 6
HIGH 4
HIGH 5
PAUSE 50

LOW 4
LOW 5
HIGH 3
HIGH 6
PAUSE 50
LOW 3
LOW 6
HIGH 2
HIGH 7
PAUSE 50
LOW 2
LOW 7
HIGH 1
HIGH 8
PAUSE 50
LOW 1
LOW 8
HIGH 0
HIGH 9
PAUSE 50

LOOP

Knight Rider Stlye Chaser LED:

' {$STAMP BS2}
' {$PBASIC 2.5}

HIGH 0
HIGH 1
HIGH 2
HIGH 3
HIGH 4
HIGH 5
HIGH 6
HIGH 7
HIGH 8
HIGH 9
PAUSE 500
LOW 0
LOW 1
LOW 2
LOW 3
LOW 4
LOW 5
LOW 6
LOW 7
LOW 8
LOW 9
DO

HIGH 0
HIGH 1
HIGH 2
PAUSE 50
LOW 0
HIGH 3
PAUSE 50
LOW 1
HIGH 4
PAUSE 50
LOW 2
HIGH 5
PAUSE 50
LOW 3
HIGH 6
PAUSE 50
LOW 4
HIGH 7
PAUSE 50
LOW 5
HIGH 8
PAUSE 50
LOW 6
HIGH 9
PAUSE 50

LOW 9
HIGH 6
PAUSE 50
LOW 8
HIGH 5
PAUSE 50
LOW 7
HIGH 4
PAUSE 50
LOW 6
HIGH 3
PAUSE 50
LOW 5
HIGH 2
PAUSE 50
LOW 4
HIGH 1
PAUSE 50

LOOP

Sunday, November 27, 2011

Why DuckDuckGo has it wrong!

Until Recently I have never heard of DuckDuckGo.com. It's a search engine that doesn't track you, or put you in a bubble. Sounds good right? Well, they got it wrong! They have an illustrated website called http://dontbubble.us on the website, they explain that other search engines will give you results based on other sites you have visited, putting you in a bubble, and not showing or showing results outside the "bubble" lower in ranking on the search results.
So I did a little test of my own. Now I am a big Star Trek fan, that's no secret. and I used the 3 big search engines, and DuckDuckGo.com, here are the pictures of my results when I searched, "Who is the better Captain?"






In the 1st picture you see the results of duckduckgo and google. In the 2nd Bing.com and Yahoo.com. I didn't say anything about which "Captain" I was looking for, it was a pretty generic question so just about anything could have come up in the search. Well with out tracking or putting me in a bubble, I get things like "Captain America or Batman" or "Dhoni or Dada", from DuckDuckGo, Bing and Yahoo. But Google putting me in a "Bubble" gave me results that are more suited to my interests. Namely "Captains from Star Trek" and then four or five results down the page I got the results that were like the other engines. In otherwords, google put what it thinks I might be looking for near the top of the results, based on websites, or other searches I have done, but it didn't exclude the results I wasn't looking for.
Where in duckduckgo I had to search the results for what I was looking for. I want to be put in the "bubble" I want results that are much more to my interests then non-relative results.

OK, so what are the results if I change the question "Who is the better captain Kirk or Picard?"






This time the results for all four virtually identical, and on Yahoo and Bing they appear to be identical. What does this prove? Well in my mind I can't just use a generic search on duckduckgo, I have to be pretty specific about what I am looking for. While on Google I can be a lot less specific about what I am searching for, and the results will be sorted in an order that makes since and still will show results that may or may not have anything to do with what I am really looking for.

Google has it right!

Saturday, November 5, 2011

Fringe or Grimm ?

I have been a fan of Fringe for sometime now, but this season just seems like a re-hash of season 1. And honestly I am loosing interest in the show. Last nights episode (Nov 4, 2011 - Novation) did bring some of the excitement back, and started to peek my interest again. Although, it really does seem like just a different take on Season 1.
In my own opinion, Fringe should have ended when Peter disappeared. The 1 observer said "He was never born", which would have stopped Walter from going to the other side to get Peter in the 1st place, and would have prevented the destruction of the other side. We did find out that Peter had been born, but died. One from the natural causes, the other because Walter did go over to the other side, and Peter drown this time, Walter couldn't stop it. Radon Lake is a focal point. So I still maintain, that in at least one of the universes Peter shouldn't have been born, and that would have prevented this whole thing to start with.

Last week, I saw a the season premier of Grimm, this is a modern day interperatation of the original Brother's Grimm stories (NOT the fairy tails, but the stories that the fairy tails are based on) While this show does remind me a little of "Special Unit 2", it does seem to have a different twist on that idea. I know that only 2 episodes have aired, but I am really starting to think this show may have to replace Fringe on my Friday nights. Seems to me that just has just the right mix of fantasy, sci-fi, crime-drama to make it a big hit. It even has a great back story that will keep me interested at least for the foreseeable future

Would love to hear the opinion of others on this.