28 Pin Project Board Bluetooth upgrade?

I am interested in upgrading my robot to bluetooth. I used the board from the start here section on the website. I was just wondering if any one has upgraded to bluetooth with this board or if its even possibles. I have seen other setups but im not sure what i should buy or how to set it up.

 

Any help is appreciated. Thanks

Yup.

I think the bluesmirf is still the “standard” 'round here although I think now sparkfun makes a cheaper, lower power unit that is similar. Basically, the bluesmirf is going to “look like” a serial port to your computer once it is paired. From there, you can send and receive data from a terminal program, or from something you have written in VB, processing, python or the like. The connections are pretty straight forward, Rx and Tx and power. You would be connecting to a couple “regular” pins on the picaxe if using the serin/serout commands. Connect to the “hser” pins to use the hserin/hserout commands --these are pretty nifty and can do a lot more than the “regular” serial. They can receive in the background and also interrupt when you “get something in”. You can also use the rx/tx pins (the ones used to sync your program in) by using the sertxd and serrxd commands (I wouldn’t do this). If you are used to using the serrxd/sertxd commands say, for debugging, or if you have simply sent any serial data (like an LCD or something) the BT set-up and use should be pretty easy to figure out.

The RN-42 Bluetooth module

The RN-42 Bluetooth module now sells for $16 at Mouser, cheap if you have an smd soldering tip.  FYI you can glue these upside down to a board and solder small gauge wires to the necessary pins, and I think you can get away with soldering only one of the five ground pins.

ok thanks for the help.

ok thanks for the help.

Hi CTC. I’m a little

Hi CTC. I’m a little confused and have been trying to set something like this up for the last few days.

When you say to connect to “regular pins” if using serin/serout, do you mean a couple of the Analogue Input pins? If so, do I just assign one pin to Tx and one to Rx?

I’ve been playing around, and have managed to get my PC (Hyperterminal) to actually talk to the Bluesmirf, and can enter CMD mode etc, but I made a lead to go to the 3-pin white serial connection. I’ve tried using hserin/hserout (after putting hsersetup in my code) but I find that all very confusing (scratchpad etc??), so I want to use serin/serout, which I feel more comfortable with. I’m still very much a noob :frowning:

Something else you could confirm for me, if you will. I understand that the 28x1 runs at 4Mhz, and has a maximum baud rate of 4800. So,as the Bluesmirf has a minimum baud rate of 9600, I have to use the ‘setfreq m8’ command to get the Picaxe to work with it. Is this correct?

All I’m trying to do is send a “w”, for instance, from Hyperterminal to my picaxe, through the bluesmirf, and have the picaxe recognise it as such, and carry out a procedure in the code. I have had the code working with serrxd/sertxd using the download cable (USB and stereo pin), through Hyperterminal, but now I want to go wireless :slight_smile:

Sorry to hijack your thread, Jaryd.

Almost there…

If you have the Bluesmirf talking to hyperterm, you have done all the hard stuff.

Serin is fine for now --Hserin kicks its butt, but we can get to that later. KISS.

“Regular” pins on a x1 would be a digital input and a digital output. Does not matter which. Input on the picaxe goes to TX on the bluesmirf and output on the picaxe goes to RX. --You are guaranteed to mix these up so when it doesn’t work, try switching them. I never get it right the first time.

Baud rate. Yup, the x1’s top out at 4800 baud. There are 2 fixes. You can go into hyperterm and change the bluesmirf to 4800 baud or change the picaxe. If the bluesmirf is syncing and working now, DON’T FRIGGIN’ CHANGE IT!!! Instead, lets fix the picaxe. Yes, bump up your frequency. setfreq m8 is correct and will allow you the 9600 baud you need. Now, the picaxe is stupid and does not realize it is now going twice as fast. Your pauses for example, are going to go twice as fast (pause 2000 = 1 second now)  --and-- now 4800 baud suddenly turned into 9600 baud. Ta da!  --Or at least that how I remember it being done…

Start the program with the setfreq stuff.

Main loop is something like this: (I can’t remember the serin command structure)

Main:

serin pin_something,T4800_8,B1   '***Play with N or T, 4800 or 9600 and 4 or 8 if it still does not work

sertxd(b1)

sertxd(13) 'goto the next line in the little picaxe terminal

goto main

That should be it. This should spit-back to the picaxe terminal, anything that the bluesmirf gets. Send stuff from hyperterm, see if you get it in the picaxe terminal. --Note: The increase in frequency will affect a lot of other stuff. The manual will note most of the problems you come across but when in doubt, if something is now not working, it is probably caused by this “overclocking”.

Many thanks, CtC. You are a star :smiley:

Not only have I got it working, now, with your help, but have even got it working from my mobile phone !  YAY :smiley:

BTW, I didn’t use sertxd, but serout.

Hser

Alright! Now that you have it working, give that hser stuff a shot. This is sorta the only “multitasking” that a picaxe can do and it’s pretty cool. When set-up properly, the picaxe will recieve in the background and write the data to a scratch pad. The scratch pad is simply memory, and each memory “spot” can hold one byte. These spots are numbered 1,2,3,4,5 etc. When data is recieved, it gets written to this scratch pad (starting at a number you want --usually 1) and it just sits there until you want to use it. You can also set up the hser stuff so it will interrupt when it gets something. You would add a routine at the bottom of your program called “interrupt” and whenever you get some serial data in, the picaxe will automatically run this routine. --In this case, the interrupt routine would probably be there to read back the data from the scratchpad.

Yes, the hser stuff is pretty complicated, but if you figure it out and get it running, it can be pretty handy.

Congrats on getting up and running.