Hackbass - My first really involved project - Page 1
Forum section: electronics / beginners

author: danrulz98
author_rank: Newbie
timestamp: May 23, 2011, 07:33:57 am
content: Hello there!I couldn't find a place for an introduction, but I guess this is as good a place as any, right?I'm Dan, I've had an interest in everything electronic since I was a little kid.I've built several simple electronics, like headphone amps and whatnot, but never really got into the dirty parts of designing something special.I'm also just getting into micro-controllers and I've been playing around with the MSP430 chips a little, and trying to learn C programming.Which, I guess does bring me to the project I had in mind to really get involved with this setup... I'm the kind of person that learns by breaking stuff and making it work again. So, this is probably the kind of project that's way over my head, but I know I'll learn a lot from re-doing it several timesIn that, I have questions about the real capabilities of the MSP430 chips and how to get the most out of them.My plan is to take a Big Mouth Billy Bass and.. tweak it a bit..Simular to this:So, this is an ARM9 controller.. and these little kits (mbed) are quite expensive.. Hence, wanting to use the MSP430. Anyway, the people that did this at one point had the fish set up so it would read twitter messages sent to it on a live stream.So, I want to try to do this. I have the fish, I have a Launchpad for programming the MSP430, I have two "free samples" of Ithink(I don't remember) ofMSP430G2452chips and aCirrus CS8900AEthernet controller, which TI mentions in their documentation as working well with the MSP430 chips.I'm worried that the controller won't be powerful enough to do everything the fish needs. I'm wondering if I could use two together to get all of the functions. One controlling the network interface and stuff involved with that then the other controlling the robotics of the fish.I'm pretty sure this is what the controller is going to have to do:* 3 servos (mouth, body, tail. Recycle controllers from the fish)* Analog audio output (probably recycle bits of the fish here too)* Read configuration, coordination, replies, and sound bites from an SD card* Be connected to the network (Ethernet and DHCP) and receive Twitter updates, possibly post them as well* Text to speech (maybe?)* (optional) web page for web-based configurationI know the thing isn't going to have enough flash memory for everything, but I'm curious if there's a way to put executables for it onto the SD card. I know I'm at least going to have to put configuration and sound bites on it.What I want in the end is someone to be able to sent a twitter message to @hackbass and have the fish read it aloud with tail and body movements.If its something common like "Hello @hackbass" or "how are you @hackbass" it can reply appropriately. And/Or, also post occasional status updates like "@hackbass is cold" if it's cold in my shed or "Its dark in here" if the light for the camera goes out.My hope is to have the fish be a stand-alone unit. All it would need is power and Ethernet and it would do its thing. (Optionally, could have a web interface so you could change what twitter account it uses if so desired... wouldn't need that except for a production/kit thing though).Eventually, this would be on a live video stream on hackbass.comSo, that's my project for the summer.. Some input from MSP430 experts is greatly appreciated...

author: tsmz
author_rank: Contributor
timestamp: May 25, 2011, 01:10:43 am
content: The MSP430G series (which TI calls the 'value line') generally has too little RAM, Flash and computing power to create everything but small projects. They're literally dirt cheap, which is important for many applications, but the 256 bytes of RAM will severely limit what you can do, especially when not carefully optimizing your code.I'd suggest you select another microcontroller that's more suitable for your project.

author: Unknown
author_rank: Unknown
timestamp: May 25, 2011, 09:24:54 pm
content: I agree, implementing a full TCP/IP stack with HTTP support with 256 bytes of RAM is going to be a serious challenge. For example, the maximum transmission unit of ethernet is 1500 bytes in 99% of the cases. A HTTP response is usually much longer than 256 bytes. Even an individual tweet without any overhead will eat up half of your RAM.I would use at least something like a 32-bit ARM Cortex for this, maybe even an embedded Linux system. Fancy things like HTTP servers and text to speech are almost free in that case, and would take a fair amount of work otherwise. I might use a small 8/16-bit micro for real-time tasks like servo control.

author: Bored@Work
author_rank: Super Contributor
timestamp: May 25, 2011, 10:13:39 pm
content: WizNet has affordable ICs and modules to offload a lot of the network protocols work.Although, a reasonable capable 8-bit micro, e.g. even the old Atmel AVR Atmega32 or the more modern Atmega328 together with a Microchip ENC28j60 is a working platform for a small network device. In fact, many have been build over time, and there are a few ready-made TCP/IP stacks available.

author: Unknown
author_rank: Unknown
timestamp: May 25, 2011, 10:27:34 pm
content: Yes, something like the WizNet might work.Note that those ATmega's have almost ten times the amount of RAM (2kB instead of 256B), and the TCP/IP stacks tend to be fairly limited, eg. no fragment reassembly. Forget about standards compliance or robust implementations. Next stop: IPv6.

author: danrulz98
author_rank: Newbie
timestamp: May 26, 2011, 05:11:52 am
content: Ah, thanks for the input.The reason I wanted to use the MSP430 is because its what I have the programming interface for (TI Launchpad).I see the software for programming an ARM is free, but what about the hardware? What's required to program them?Or, am I thinking completely wrong about the ARM controller and its going to be a requirement to use some little Linux distro?

author: tsmz
author_rank: Contributor
timestamp: May 26, 2011, 01:41:56 pm
content: I'd generally recommend against starting with such an involved project. It might be a good idea to build it incrementally and use the right microcontrollers for each job. The MSP430 could well be used for motor control and analog data capture, which isn't the worst way to get started.Each new chip will require a new programming interface and you'll most likely need some sort of breakout/development board for most microcontrollers, especially those without a dual in-line package. This includes most (all?) ARM-based micros.You're probably better off by starting with popular microcontrollers with lots of source code and help readily available. I'd recommend getting some relatively high-end AVRs or PICs for that purpose.

author: Trigger
author_rank: Regular Contributor
timestamp: May 26, 2011, 11:35:05 pm
content: MSP430 isn't going to do what you want, it just doesn't have enough memory.Take a look at the Parallax Propeller chip. It'll do ethernet and voice. I could nit pick at what I don't like about the chip but it'll do what you want. You can get a protoboard USB to start off with and solder some headers on it if you want to prototype. Gadget Gangster makes an Arduinoish board for it but they're about $50.http://www.parallax.com/Store/Microcontrollers/PropellerDevelopmentBoards/tabid/514/CategoryID/73/List/0/SortField/0/Level/a/ProductID/509/Default.aspxhttp://www.gadgetgangster.com/find-a-project/56?projectnum=257

author: Tony R
author_rank: Regular Contributor
timestamp: May 26, 2011, 11:56:37 pm
content: Quote from: danrulz98 on May 23, 2011, 07:33:57 ami would consider using an external servo controller to control the movements of the fish, you can get them with multiple servo output and can communicate though UART to some of them to control all the servos.For the audio output, In a class i took we used a DAC to drive this it does make it quite simple, you can use SPIas for the SD card, i have yet to have to do anything with them, so you are on your own...as for as the Ethernet, have you considered an external Ethernet driver?They used to make external chips for text to speech, if anyone knows of a good reasonably priced one i would be interested in finding out.If you are looking for a web page based configuration, they do make external web server packages that work with basic stamp chips (PIC) i would look into thatIf you haven't noticed that is alot of extra components that you will add on, I view the MSP430 line as being good for coordinating a lot of different external parts, not so good at doing it all its self (partly because of the limited processing power it has, and the fact that they have limited IO pins (at least the ones on the launch pad)the main advantage of the MSP430 is the low power, 1uA can retain the ram (at least some of them)... cant really beat that, great for things that you don't want to drain the battery.I would advise you to use a different chip. I personally have experience with the C8051, but with that you also run into limited ram issues; however if you use some of the units from Silicon Labs they do have some expanded memory (4 Kb). I was able to get the C8051f340 to control 350 LEDS; However, for a beginner the 8051 might be a little hard to program. The ARM will offer you great expansion options because of its power.So bottom line is that it is possible with the MSP430, if you write very condensed code (mind you I enjoy writing in assembly and pressing the limits that a chip can do), however other options are more desired.Maybe a simpler project that you can add on to perhaps using serial communication to control the fish from a computer (RS232 and a VB application, a tleast i think VB works well for this kind of application, simple, easy, and works). Later versions of the project can have text to speech, then maybe go away from the serial communications and going with using Ethernet (aka babysteps) get one thing working very well before moving on to the next feature. Maybe design a PCB to go with it, make it look nice.Good Luck with your project.

author: danrulz98
author_rank: Newbie
timestamp: May 27, 2011, 02:16:20 am
content: Thanks for the support and helpYeah, I'm gonna have to do it bit by bit of course. I'm not planning on having a finished product with a first build/attempt at a build.I was already counting on using a lot of external pieces to handle things like Ethernet and audio.I was looking at the ARM controllers that TI has, and it looks like a lower end one even would give me the SD interface, and 10/100 ethernet as well as probably more than enough RAM for it but also the ability to use DDR2 RAM (which I have a bunch of 128MB/265MB sticks of laying around).I could still use an MSP430 as motor and button controls and have it communicate to the ARM over a serial interface or something.Tony, I was thinking about using a computer as a "host" of sorts and having it communicate with the fish over parallel or serial. I decided against it because, well, I wouldn't need a micro controller at all with parallel communication (I've made light controllers like that before) and I wanted to get into using them.I think at first I'll try to get it to be controlled from a computer over serial then eventually replace the computer with an ARM controller.I'm still a little confused as to what an ARM controller will expect. Does itneedexternal ram and flash or is it integrated like the MSP430 or does it depend greatly on the manufacture? I know there's a lot of manufactures of them and looking through TI's, it looks like all of them have some form of on-chip ram.Mm, I'll probably try to figure out a way to make the PCB modular so I can have all of the motor control with a serial interface then later on add the board for the ARM controller.I downloadedFritzingand the freebie version of Egal to play around with too

author: Trigger
author_rank: Regular Contributor
timestamp: May 27, 2011, 04:00:55 am
content: Quote from: Tony R on May 26, 2011, 11:56:37 pmThe MSP430 is long in the tooth. Atmel and Microchip both have micros that will use less power. Energy Micro has an ARM micro that does as well.

author: Tony R
author_rank: Regular Contributor
timestamp: May 28, 2011, 01:23:07 am
content: Quote from: danrulz98 on May 27, 2011, 02:16:20 amI have not yet done any projects with the ARM; however, it is on my list of to-dos. I do however have classmates who worked with an ARM processor, one from STMicro, the STM32F103RB to be exact. To my knowledge they did not need any external ram or flash to do what they where trying to do, which was to control a robotic arm via a serial input from a computer. However, the ARM they used was probably overkill for what they where trying to do. Also the features for every ARM processor will vary, READ DATASHEETS! I have been tripped up by assuming things about components that are common, but turn out not to be true for my application.as far as making it modular, do what the Arduino boards do, have a header connection for every pin. On your main board I would have my CPU, Power regulators (one for the processor (3.3V?) maybe a 5V for other chips and whatever is needed to drive the servos. I would also have the JTAG adapter, serial/USB connectionI would conciser having on separate modules, Ethernet (wifi?), Text to Speech, a temperature sensor (great application for the MSP430, the demo app on the launchpad is a temperature sensor and sends feedback via UART it would be stupid simple to get that to work with TI's code available on the website.) I would build the web interface into the Ethernet card, unless you choose to embed linux onto the ARM, then the game plan changes significantly.one thing that would be cool is to have a small pinhole camera on the bass for motion detection, security, light/dark sensing, maybe some day facial recognition

author: Unknown
author_rank: Unknown
timestamp: May 28, 2011, 12:55:08 pm
content: Quote from: danrulz98 on May 27, 2011, 02:16:20 amThere is a large variety of ARM cores, from the small Cortex M0/M3 cores to something like a Cortex A15 used in smart phones. The latter require external RAM, the former are small micro-controllers with internal RAM and flash. Something Cortex M3 based would probably be what you want if you don't want to run Linux. I would recommend against external RAM if you can help it, since it adds significant complexity to your PCB design. ARM Cortex M3 MCUs are available with built-in peripherals like ethernet (eg. LPC1768). The three vendors that appear to be popular with hobbyists are NXP, ST and TI. Something like the LPC Xpresso w/ LPC1768 or even an mbed might be a good start. ST has an STM32VLDISCOVRY, but the MCU on it is somewhat less powerful and lacks an ethernet MII.

author: danrulz98
author_rank: Newbie
timestamp: May 28, 2011, 11:46:33 pm
content: I'm not concerned about Ethernet, I have the Ethernet controller as a separate part, as I mentioned. It wouldn't be that hard for me to make the motor controller with an MSP430 and use its own temperature sensor as well and make it with a standard serial port on it. That would make it easier to interface with a normal computer as well until I can get the ARM stuff worked out. Running a mini linux distro is looking to be a very probable idea.As for motion and light detection, the fish has that already. You can set one up in an auto mode so it starts singing when someone walks by. Not sure what I'd want facial recognition for...Just kinda browsing around a bit, I foundthis, which looks like it'd be just a touch overkill but it'd work. It's certainly got the clock speed to handle a small linux distro, and i know it'd be more complex but I could use some old RAM that I have laying around with it. But, it'd let me control the MSP430 over UART and still have an additional serial port for programming/terminal. It also has the SD card interface right there as well, and even a couple USB ports. (It was also the first on the list when filtering by which processors would work with Linux). And, well, I can get one as a free sampleThanks again for the support everyone. I feel like I'm already learning a lot from this discussion.

author: Trigger
author_rank: Regular Contributor
timestamp: May 29, 2011, 01:06:22 am
content: You're a bit off base if you think you're going to run a Linux OS on a microcontroller. There are RTOSs that can be run but that's for applications quite a bit above what you're trying to do and they're highly specific event handlers not a general operating systems. If you're looking to run Linux you'd need something like a Gumstix with a roboboard and for the task thats like dropping a tank on a nail to drive it in.If this is your first project and you're talking about running linux on it then you've skipped the deep end of the pool and went into the northern Atlantic during storm season. You're trying to do computer engineering when you don't even have a good base in electrical engineering yet. You've asked questions and gone from MSP430 to an ARM processor running linux which says enough about your knowledge level. I'm not trying to be mean, just giving you a reality check and getting your feet back on the ground if you really want to do your project.KISS1. Make it move first then use an ADC to sample a microphone to get its move sequence correct. That's a big project for a beginner on it's own.2. Make it say what you want. You can use a speakjet or propeller chip for this and guess what? If you pipe the output of the speakjet into the movement circuit where the microphone was connected it'll move with what the speakjet says. You can use a serial link to tell it what to say at this point. That's another project of it's own.3. Now you can look at adding an ethernet connection. If you want it stand alone then you've got to request a page and parse it, that takes memory. If not then have some software on your computer get the tweets and send it. You can also just make it wireless with some Zigbee chips and stay with serial data to the speech circuit letting a computer handle the fetch and parsing.Break your project into manageable pieces.

author: danrulz98
author_rank: Newbie
timestamp: May 29, 2011, 03:27:11 am
content: Of courseI'm planning very far ahead.1. Going to make it move with the MSP430 and a serial connection to a computer. Can use the Windows speech software to read the output of a simple script or something and have it try to coordinate some movement from it as well. That much should be rather simple.2. The arm stuff and getting it to run on its own will be a much larger more involved project.3. ARM chip and Linux should handle Ethernet just fine. Would just need to add a sound interface and something similar to the Windows speech software and port my script to Linux.As for jumping around, yeah, I seem like an idiot. I realize this. I wasn't sure what the MSP430 was really capable of and I wanted to know what other people have been able to do with it. But, now realizing that an MSP430, at least not a ValueLine model, would barely handle even a TCP stack, I'm looking into something that would be overkill but that seems to be well documented and tested, and overall very popular. I would get an MBED setup, but they're rather expensive... I'm trying to work with stuff I can get for free/cheap or that I have on hand. Yeah, I'll probably get fed up at some point and get an expensive board to drive it. As it is, I can't afford that. Right now, I'm looking at only having to pay for the PCBs to assemble it all and probably some solder paste and fluxThe ARM chip I found, I just filtered through TI's website kinda quickly and found that one. It seems like something that would be way overkill, but I'm having trouble finding something that isn't either overkill or very small. I'm used to dealing with either full computers or smaller, more simple projects. I've done things before like making the headphone amps and repairing countless electronics and studying how they work. But, considering more and more stuff is being built with micro processors now and digital controls, I want to really dig into it. Hence, the point of this. I do expect this to take quite a long time, it might be up to this time next year and I'll only have the motor controls working, I don't know. I just wanted to get some input to make a more long term plan. Sorry for making myself out to be a moron.Maybe I don't really even need to go into the ARM stuff and can re-purpose something else to do the job (like an iPod Touch).

author: Trigger
author_rank: Regular Contributor
timestamp: May 29, 2011, 03:40:00 am
content: I didn't imply that you were a moron. You seemed like you were jumping in way over your head is all. Try experimenting with various microcontrollers on a breadboard. You can learn a lot that way and get use to programming them. Your project can be done with microcontrollers alone just take some time to get familiar with them in practice and you'll do fine.

author: danrulz98
author_rank: Newbie
timestamp: May 29, 2011, 03:43:56 am
content: And I value that opinion and what I was hoping to do from the beginning. Someone else suggested I use an ARM system and run Linux on it so I followed that rabbit trail for a while

author: tsmz
author_rank: Contributor
timestamp: June 02, 2011, 04:02:33 pm
content: I think you need to think about this for a while and then decide what to do next.It basically boils down to the question of what you want to accomplish with this project. So natually, there are many ways to go:(1) The MSP430 is a nice MCU for learning the basic stuff, there's everything you need right there and it's configurable quite nicely.Multiple oscillators, low-power modes, I2C, SPI, a great timer, good interrupt modes, a decent ADC, and some EEPROM thrown in for good measure. The MSP430 value line's peripherals are selected really well for these chips. Absolutely lovable. The downside is that you won't be able to actuallydofancy things with the value line chips. They're fantastic for learning the basics and given the launchpad's price, it's quite a no-brainer to actually start with it. You'll even get the integrated debugger as a bonus which allows you to look at register contents while the program is running on the actual MCU. If you want to learn microcontroller programming, the launchpad is the way to go. Get some nice external components for playing around: Sensors, a couple of shift registers, a bag of LEDs, a small text LCD, etc. This probably won't cost you terribly much, depending on how fancy the sensors need to be. There are lots of sensors with a variety of different interfaces, and I'd recommend to try all of them: Analog voltage output, frequency/pwm output, I2C, SPI, 1-wire etc. 1-wire sensors can't be interfaced to the hardware directly, so you'll have to write some software to handle communications. This should really take you through the whole microcontroller feature set and peripherals. And it'll be basically the same for every microcontroller you'll find, or at least you'll be able to adapt it quickly, as you'll absolutely need to read the datasheet to succeed in programming the MSP430 as well.(2) I don't know anything about embedded Linux MCUs or MPUs, so I can't comment on it. Sorry, not much more to write about this, maybe other people can help you there. Development systems generally tend to be expensive.(3) If you don't care that much about the intricate details of microcontroller programming and are more interested in getting your project done than learning the inner workings of microcontrollers, you'll want a cheap development system with lots of libraries and accessories. In other words: If you want (more or less) instant gratification, get an Arduino. It's such an obvious choice for these kinds of projects that you probably haven't thought about it. The standard library is pretty good, although it's clearly optimized for programming comfort rather than speed or memory consumption (a completely insane decision to make in any real-world application), but the MCU is overpowered anyway, it works out quite well. You can buy shields and whatnot for more or less anything, twitter included. Shields are generally priced adequately, but there are a few way overprices ones.The problem with arduino is that it allows people to do quite advanced stuff without thinking about it for half a nanosecond. And because it's so easy, everyone who's able to create simple arduino programs by buying a few shields, plugging them in and tweaking the supplied example programs will be an "arduino expert," and because the arduino community values nothing above sharing everything, that's why there are tons and tons of completely bodged-up solutions for almost anything on the web and that's probably also where the hate comes from.The arduino platform is a nice platform, but you shouldn't be clueless about what you do, even if there's a shield for your particular problem. The arduino community seems to prefer some strange components no one in their right mind would use (e.g. photoresistors), but that's another story. Please note that the arduino platform can be used for serious programming. It's not a dumbed-down version of the AVR MCU, but rather a large library with lots and lots of predefined functions. That's great for prototyping or getting things done quickly, which may be all you want to do, but it wasn't designed as an evalation or learning platform, so the focus doesn't lie in educating you, but rather allowing you to accomplish your project.That's quite a lot of text, but you seriously need to think about what you want to do, how much time, money and effort you're willing to invest, and only then look for suitable solutions or platforms. Doing things on a whim will only annoy you (because you won't get anything done, because it's not planned correctly and the parts will not fit together).