Show Posts
Pages: 1 2 [3]
31  Using Arduino / Programming Questions / Re: Stepper Moves, IR Flashes, Repeat... How? on: February 09, 2013, 02:50:03 pm
Hi IntelliTom.

Looks like you are almost there. I don't have the kit to fully test but this might help a bit.

So you can see in the Arduino sketch there are three main parts,

there's the part at the top where you can include other 'libraries' and you can initialize variables.

Then there is the void setup()   part and this part is usually used to set everything up, change the pinModes, etc.

Then there is the void loop() part and usually what happens in a sketch is that the code will be looping around in here waiting for things to happen and then reacting to those things.

So normally everything would be going on in the void loop() part where for example you might have a button set up and then when the user presses that button the program would turn the stepper motor to the required position and then when it was at the correct position it would fire the camera, then wait again for the motor to turn etc. then fire the camera again etc.

Here is an idea how to do it although you may need to adjust some things, have a play and see if you can get it to work, you can't break anything smiley

#include <AFMotor.h>
int IRledPin =  13;    // LED connected to digital pin 13
AF_Stepper motor(200, 1);
int NumberOfPictures = 10;  // How many pictures should we take?
int CountVariable = 0;  // I'll use this to keep a tab on how many pictures we've taken so far.

void setup()   {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  pinMode(IRledPin, OUTPUT);

void loop() {
 if (CountVariable == NumberOfPictures) return; // Stop now as CountVariable indicates that we have taken the correct NumberOfPictures

 delay(500); // wait half a second for good measure
 delay(500); // wait half a second for good measure
 CountVariable ++; // increment the count variable so it is actually counting :)
}  // at this point it will go to the top of the loop at the void loop() line and start again.

// This procedure sends a 38KHz pulse to the IRledPin
// for a certain # of microseconds. We'll use this whenever we need to send codes
void pulseIR(long microsecs) {
  // we'll count down from the number of microseconds we are told to wait
  cli();  // this turns off any background interrupts

  while (microsecs > 0) {
    // 38 kHz is about 13 microseconds high and 13 microseconds low
   digitalWrite(IRledPin, HIGH);  // this takes about 3 microseconds to happen
   delayMicroseconds(10);         // hang out for 10 microseconds, you can also change this to 9 if its not working
   digitalWrite(IRledPin, LOW);   // this also takes about 3 microseconds
   delayMicroseconds(10);         // hang out for 10 microseconds, you can also change this to 9 if its not working
   // so 26 microseconds altogether
   microsecs -= 26;
  sei();  // this turns them back on
void SendNikonCode() {
  Serial.println("Fire Camera!");
  delay(65); // wait 65 milliseconds before sending it again

void RotateTT() {
  Serial.println("6 Double coil steps");
  motor.step(6, FORWARD, DOUBLE);

32  Community / Products and Services / Re: Where to advertise my android bluetooth interface software? on: February 05, 2013, 05:45:56 pm
I've uploaded a new version of BTInterface.

I've taken your remarks to heart.

Firstly I've added the ability to choose the annoying sound effects that you wish to play on connection and disconnection of the Bluetooth module.
You can also choose '0' (zero) to have no sound effects and as these (16) sound effects are the same ones that you get by sending the sfx commands (sfx1 sfx2 sfx16) then this doubles up as a good place to try out the sound effects (press the little speaker icons to play the sounds).

Secondly I have added the ability for the micro controller programmer to determine what string is sent when the user presses a button.
This can, like the sound effects, be chosen in the settings (menu - settings) or it can also be done in code if the micro controller sends the string b1send   b2send   b3send or b4send so for example if when I press b1 I want the string 'activate' to be sent (instead of the string 'b1') then I'd program the b1 button by either doing it in the settings or sending the command over the serial connection:
b1send activate

Then each time I press the b1 button it will send that word 'activate' which you can see if you press it a few times then look at the log in the terminal screen.

Please note that I've only done this for the four user buttons at the moment as the game pad buttons are, well, game pad buttons smiley so remain as up, down, left, right & fire

I also did a considerable bit of work on the help system which is like a complete website inside the app smiley

Please let me know what you think and keep the suggestions coming.... and please join my forum smiley no-one's joined my forum yet ... well, only one has ... smiley-sad

33  Community / Products and Services / Re: Where to advertise my android bluetooth interface software? on: February 03, 2013, 12:24:55 am
Yes, I have to think of making it basic and fundamental.

when you press button1 it sends b1 and that's pretty simple.
What you are suggesting would in any case require that you program it to send what you wanted it to send so I don't think being able to program the device to send different things when you pressed the buttons would make it simpler.

Having events like button pressed and button released doesn't work very well with a serial link because you would have to send a command which meant 'button one is now pressed' and then send another command with 'button one is now released' but because of the nature of sending text across a serial link and what with the timing issues of the whole serial setup I can't see that working. In any case that isn't the way I've designed BTInterface.

I want something that is easy and fun to use, in the same spirit as the Arduino smiley

My app is very simple, press buttons, configure screens. You might find that ArduinoCommander has more complex functionality that might be better suited to accurate timing.

BTInterface is the interface, just that, its not supposed to be the brain smiley

34  Community / Products and Services / Re: Where to advertise my android bluetooth interface software? on: February 03, 2013, 12:03:59 am
Like the other app, the text output area is flawed in that it doesn't scroll to the bottom when you get new output
From this I deduce that you are talking about the Terminal screen (in my BTInterface app).

The Terminal screen will mostly be used for debugging to see exactly what your microcontroller sent over the bluetooth link.
There is a limitation to the Terminal screen which I don't plan on changing just yet and that is that if a line of text is too long it is lost off the right hand side of the Terminal screen.
You do get to see a bit more if you orient to landscape and in the future I may make it sideways scroll but just now this is a limitation.

While the terminal screen is being viewed, and it can be called up even from standby by sending the string 'terminal' to BTInterface, you can send the command 'clear' to clear it.
I would call it 'input' rather than output, that is when you receive something from the microcontroller into the terminal screen I'd say that was input and when you enter something into the send field and press send, i'd call that output but tomatoes potatoes smiley I did program it so that upon receiving 'input' smiley from the microcontroller its supposed to scroll down to the last line automatically. Is it not doing that for you? what device are you using?

The Terminal screen can be used for collecting data from a user, you could switch to the terminal screen:

issue the clear command:


and then tell the user what you want:

send("please input your credit card details");
send("so that I may syphon off a bit");
send("thank you");

and after all this setting up your sketch would be waiting for the user to type something and press the Send button.

In the future I may introduce other 'screens' and cunningly call them names like   screen2   screen3   etc.  but I feel it necessary at the moment to test the waters with a basic version of BTInterface, get people using that and then see what the popular demands are before making any radical changes, always trying to keep new changes backwards compatible.

I think this first version does pretty good.  I may introduce flashy texts and bold and italic and all-singing all-dancing colours and perhaps even have it vibrate when you stick it in your pocket which will be nice but not until I have a clear indication of the direction that people want it to go in smiley

When I get it to control my jet engine smiley oh yes... I will configure screen1 to have just the slidebar (to control the throttle) then b1 will be 'Bendix On' (for the bendix clutch 12v motor that spins the turbine) and when I press it, it will turn the motor on and change the text on b1 to read 'Bendix Off' etc. then b2 will read 'Gas On' which activates the electric valve for the butane/propane starter gas cannister then b3 will read 'Glow On' which turns on the glow plug.

I'm thinking of making b4 into 'Auto Start' so it'll do it all automatically and get the jet running up to a reasonable speed because I put the engine on the back of my moped smiley and its otherwise a bit awkward to do it manually when you're trying to navigate bumpy roads.

Jetduino  smiley-grin

35  Community / Products and Services / Re: Where to advertise my android bluetooth interface software? on: February 02, 2013, 11:25:40 pm
With BTInterface your main loop would be listening out for the string 'btinterface' this is to detect when it is connected.
Then when it heard it you would have a routine to change to screen1 where you could configure the controls.
You would hide all the controls that you don't need and change the labels on the buttons etc. and if necessary write some text in the labels that align with the main 4 buttons.

This configuring of screen1 might initially be in a function and then you might have several functions to configure screen1 in different ways.

Pressing any of the buttons will always send that buttons value and this can't be changed so pressing the b1 button will send the string 'b1' over the serial connection.
You would be responsible for knowing where you are in your code and what that b1 means at that point.

Here is a simple bit of pseudo code to illustrate where the character ' designates comments:
void loop(){
if(command == "btinterface"){
  config1() 'if I see the string btinterface then I know that we have a connection, either for the first time or after a disconnect so I'll call the function config1() to configure screen1:
 intMode = 1 'set variable so that I know I'm in 'config1' mode
} 'end of if statement

if(command == "b1") { 'then I know that b1 has been pressed
if(intMode == 1) { 'then I know that b1 has been pressed while I'm in Mode1 so I'll do a mode1 button1 press thing
send("say Ooh. I see you are in mode one and that the button which currently reads as. Action One!. has been pressed.")
send("sms 0123456789 this is a text message from your microcontroller just to let you know that I am currently in Mode 1 and the button Action One! has been pressed.")
'do other Mode1 Action One! things here.
'perhaps Action One! needs the screen1 to be reconfigured into mode 2? if so then:
intMode == 2

} 'end of loop

void config1(){
send("screen1") 'this causes BTInterface to change to screen1, also if BTInterface was sitting in the background this will cause screen1 to appear, it is only while screen1 is displayed that you can configure its controls.
send("pad hide")
send("sb hide")
send("b1 Action One!") 'this changes the text on button1 (b1) to read Action One!
send("b2 Action Two!")
send("b3 Action Three!")
send("b4 Action Four!")
'there, I have finished configuring screen1 into 'config1' mode.
} 'end of config1() function.

Here is the actual sketch from my 'A little Scary' video ... please forgive the prehistoric programming techniques smiley I've never done C/C++ before.
#include <SoftwareSerial.h>
#include <Servo.h>
#include <stdlib.h>

Servo myservo;
SoftwareSerial softSerial(10, 11); // RX, TX
String command = "";
int r1 = 0;
int RelayPin = 2;
int val;
int pr1 = 3;
int pr2 = 4;
int pb1 = 5;
int pb2 = 6;

void setup() 
  Serial.begin(9600); //Remember to set the Arduino Serial Monitor to 9600 Baud and no line ending if you want to get AT commands to work before you connect.
  softSerial.begin(9600); // SoftwareSerial "com port" data rate. JY-MCU v1.03 defaults to 9600.
  softSerial.println("Arduino Ready!");
  pinMode(2, OUTPUT);
  pinMode(pr1, INPUT_PULLUP);
  pinMode(pr2, INPUT_PULLUP);
  pinMode(pb1, INPUT_PULLUP);
  pinMode(pb2, INPUT_PULLUP);
  digitalWrite(RelayPin, LOW);
void screen1set(){
void loop()

  if (Serial.available()) softSerial.write(;
  while(softSerial.available() > 0) { // While there is more to be read, keep reading.
    command += (char);

  if(command != "") Serial.println(command);
  if(command == "btinterface") screen1set(); //
  if(digitalRead(pr1) == LOW){
    send("say you pressed, red? 1.");
    send("say stand by. I shall initiate the turning on and off of relay 1.");
    send("say in. 5. 4. 3. 2. 1. ");
    command = "b1";
  if(digitalRead(pr2) == LOW){
    send("say self destruct sequence aborted. phew!");
  if(digitalRead(pb1) == LOW){
    send("say no? that was a blackwon. stupid?");
  if(digitalRead(pb2) == LOW){
    send("say self destruct sequence has been initiated. this system will self destruct in 30 seconds. press any red button to abort self destruct.");
  if(command.startsWith("sb")){ // Then the slidebar has been moved so alter the position of the servo!
    val = stringToNumber(command.substring(2));
    val = map(val, 100, 0, 0, 179);
    send("l4 " + command.substring(2));
  if(command == "b2") {
   send("sms 07951123456 This apparatus will self destruct in 10 seconds!");
   digitalWrite(RelayPin, HIGH);
  if(command == "b1"){
    if(r1 == 0){
      r1 = 1;
      send("b1 Relay Off"); 
      digitalWrite(RelayPin, HIGH);
    if(r1 == 1){
      r1 = 0;
      send("b1 Relay On"); 
      digitalWrite(RelayPin, LOW);
  if(command == "b3") send("say Hello Ian. Remember to get to work on be tee interface?");
  command = "";
}// End Loop

int stringToNumber(String thisString) {
  int i, value = 0, length;
  length = thisString.length();
  for(i=0; i<length; i++) {
    value = (10*value) + thisString.charAt(i)-(int) '0';
  return value;

void send(String s){
36  Community / Products and Services / Re: Where to advertise my android bluetooth interface software? on: February 02, 2013, 09:39:37 pm

jack_fr  has made it, looks good!,91261.0.html

Yay! you got it working! welldone.

As I thought, your module can:
•User can connect 3.3 to 5VDC and connect TX and RX to your control IO (general 3.3 to 5V digital input output of MCU or arduino IO is ok, or general TLL IO)
They're pretty indestructable smiley You can connect them to 3.3volt or 5volt logic with no problems.

I really, really, really hate that BTInterface makes a sound when connecting and disconnecting.  There appears to be no way to shut up the program.

This is exactly what I need, someone to constructively criticise so that I can figure out what people want and what they need to fine tune BTInterface to be the best that it can be.


I shall put another panel of options in the settings (Menu button/Settings) where I'll make both the 'connected' annoying sound and the 'disconnected' annoying sound optional smiley-grin

Actually I think I'll make them numbers so that you can choose your own annoying sound effects smiley-grin (or leave them blank for none).

Thanks Michael, please keep the ideas coming!

37  Community / Products and Services / Re: Where to advertise my android bluetooth interface software? on: February 02, 2013, 06:05:09 pm
Well being a fellow modem guy you obviously know about AT commands, I built a 300baud modem for my commodore 64 once smiley

If the device is set to slave mode then the only thing I can think of why it might not work with BTInterface is the baudrate.
Should be 9600 for BTInterface which is usually the default for these modules.

I suspect that the hardware of these modules is the same and this guy called Byron made a reflasher:
To flash the software where I believe I could flash the HC-05 software on to my module which I think is the HC-06 (slave only).
If it is the same hardware then I can assure you that it works fine on the 5v Arduino, should work between 3.3 and 6v.

All BTInterface does is start the Android pairing process which you can do manually if you prefer.
Once the device is paired it should be just a normal serial bluetooth device although I have noticed that it always says 'paired but not connected' even while it is sending and receiving to it smiley

You say
the problem is your app doesn't connect when other devices can.
Do you mean 'where other software can' ? Can you connect other apps but not mine?
There's another app called ArduinoCommander, can you get that one to work with your module? on the same Android device?
Its just that I'm not sure if its something to do with the Android device or if its specific to BTInterface?

In any case I thank you for trying BTInterface smiley

38  Community / Products and Services / Re: Where to advertise my android bluetooth interface software? on: February 02, 2013, 03:09:22 am
Yes, look at this masterfully crafted wording from the horrid manual about the HC-05:

Typical method: On some specific conditions,
master device and slave device can make pair with
each other automatically. (This is the default

So a translation means that the HC-05 by default is set to Master and it can pair automatically with another module set to slave.

This is pretty cool, it means that theoretically you could take both ends of an RS232 cable, replace them with these modules, one in Slave mode and one in Master mode (you would need some TTL to RS232 voltage level converters) and without any other work you have changed the wired connection to a wireless connection.

Earlier societies would have viewed stuff like this as black magic and accused you of witchcraft! (back in the 1980s).

Ooh! Look! a much better document, the datasheed for the HC-05 !

39  Community / Products and Services / Re: Where to advertise my android bluetooth interface software? on: February 02, 2013, 02:13:25 am
Hi Michael,

Your BT Module is better than mine smiley

Specifically because you can change its mode between Master and Slave. I may have to get me one of those smiley

The module must be set to Slave mode, I suspect that your other phones can't see it either but otherwise when it is set correctly it should display a fairly rapidly blinking LED (which is blinking evenly) and then it is 'discoverable' so you can go into bluetooth settings and 'scan for devices' to find it.

Firstly congratulations on purchasing both bits! You purchased the bluetooth module plus the backplane where it is really easy to accidentally purchase just the bluetooth module without the backplane or just the backplane without the bluetooth module everyone should read the posts on my forum at before purchasing one!

By default when its found your module should show up as  'HC-05'  (mine is 'Linvor').

Otherwise its the same as mine, you don't need to connect those extra two pins up, Key or State, you just need the power pins and the TX/RX.

Note that even without the TX & RX pins connected to anything and only with the power pins connected if the module is in the correct mode (Slave mode) then the LED will flash and you can scan for it and find it and pair with it from any bluetooth phone (mine flashes at a constant 4 hertz (ish)).

So I suspect that your only problem is that it is in Master mode and as such IT is the one who would do the discovering and not the other phones.

You can change its mode by issuing AT commands to it (modems anyone smiley )  

You can issue AT commands only while it is not paired and connected.

Use your terminal app to just send the two letters AT ... try with lower case, then upper case, when it is working sending the command AT will get it to send back 'Ok'
You may have to try different settings in your terminal app. For the Arduino its called the 'Serial Monitor' and it may or may not require a 'line ending', I leave mine set to 9600 baud which is the default that the Bluetooth module comes set at and the default that BTinterface works at.  

In mine it must be an uppercase AT to get it to return OK

Then you can issue AT commands to it, and one of the commands that you need to issue to yours is the one to put it into Slave mode.

By the way you can also do other cool things with AT commands such as:

AT+VERSION   returns the software version' This is a harmless command to send, use this to make sure you are sending AT commands correctly.

Note it must be exactly as above, AT in uppercase then the plus sign and then the word VERSION also in uppercase, then mine returns:  OKlinvorV1.5

AT + NAMEname   Returns OKname  max 20 chars     so for example issuing the command    changes the module's name to smiley so when it is in Slave/Discover mode that's what you'll see when you scan for devices smiley Remember that when you make your cool doohickeys.

AT+PINxxxx      Returns OK setpin   You can change the password!!! usually set at 1234 you can use this to change it to something else... be careful!!!

AT+BAUD1      Returns OK1200 'now set to 1200 baud

AT+BAUD2      Returns OK2400 'now set to 2400 baud

table: (you want number 4)

AT+BAUD4   to set it to 9600 baud which is the rate that BTInterface is designed for.

1   1200
2   2400
3   4800
4   9600
5   19200
6   38400
7   57600
8   115200
9   230400
A   460800
B   921600
C   1382400

I would leave it set to the default 9600 baud, note that if you change the baud all of a sudden you may start receiving rubbish characters in your serial monitor, that's cause you have to now change the serial monitor's baud rate to match smiley

And now.... tadaaaaa...... you will need to issue the command:


To set it to slave mode.

Lastly, I lied about those AT commands above, it would seem that they are different for the HC-05 as attested to in this really REALLY horrible manual that I found...

I saved it on my website here:

Note that when they write 'salve' they mean 'slave' ...  

Even more lastly I didn't lie about the AT+ROLE=0 command, that one is from this HC manual so try this first.

The correct AT commands for the HC-05 are in the horrid manual.

Hey everyone please join my forum on and I'll be glad to help with all aspects of Bluetooth doohickeying smiley


40  Community / Products and Services / Re: Where to advertise my android bluetooth interface software? on: January 31, 2013, 05:33:56 pm
Put a new video on the site today smiley

As the Arduino becomes 'self aware' it starts to get a little scary!

41  Community / Products and Services / Re: Where to advertise my android bluetooth interface software? on: January 30, 2013, 04:40:08 am
Thank you.

My first app launch smiley

Just to let you know that although the main theme of the app is to control micro controller devices over a serial bluetooth connection.

You can have a lot of fun with BTInterface with just the app as you can send it text messages to make it speak, play sound effects, popup toast messages etc.

Here's the link to it on Google Play Store:

42  Community / Products and Services / Where to advertise my android bluetooth interface software? on: January 27, 2013, 08:44:09 am
I have figured out how to connect it to PCs and Laptops using built-in Bluetooth or a dongle.
Will be figuring out how to do this with the Raspberry Pi next.
Will be brushing off the C# skills to make a windows program to use it with.
Special offer on Basic4android for anyone wishing to program their own Android apps. See this thread.

Hi folks.

I don't want to tread on any toes.

I've made some software for android phones which I will want to sell on the Google Play Store though there will be a free trial version which has nag screens but no advertising.

The idea is that you use a bluetooth serial module or shield and it will work with the Arduino (which I'm testing it on now) or any other uController with a bluetooth module.

Would it be ok to advertise it here?

I would like to get some people to try it and let me know what changes to make to it etc. before I publish it on the Google Play Store, is this the best place to advertise it?

Just to let you know, the app acts as the buttons for the device (don't they all) fully configurable/re-configurable on the fly, get it to send an sms or more excitingly get it to act on a series of commands in a received sms, kind of 'remotely control your remote controlled device' smiley, commands can be sent from the uController to get it to speak (text to speech) and play sound effects etc.

Most importantly, its fun to use and easy in the same spirit as the Arduino.


43  Community / Bar Sport / Re: L.E.D. Zeppelin on: September 19, 2012, 06:15:32 am
That is so cool!

What about making blinky sculptures like that, perhaps using the shrinkify your Arduino projects idea with the ATTiny chips?

Using a mic it should be possible to have it sound-activated smiley

Can anyone think of other ideas with L.E.D. in em' ?

44  Community / Bar Sport / Giving something back :) on: September 17, 2012, 03:18:31 pm
What a fantastic community!  read on, you won't be disappointed smiley-wink

And what a fantastic device the Arduino is!

I haven't even got my UNO yet but after all the research that I've done, watching youtube vids etc. I know it is going to be a pleasure.

What a delightful IDE!!! Welldone to the creators!

Did you know that your Arduino uses the Atmel microcontrollers? Of course you did. Did you see the bit about   ? Matt is a great tutor!

The latest version of that allows you to use more ATTiny chips with more pins!

And thank you for reading this.

Oh, here's where I give back smiley

On the website you can request FREE SAMPLES!

I requested these:

 Shipment Contents
Part Number    Description    Customer Ref    Quantity Shipped    Backorder    Cancelled    Notes
ATMEGA328P-PU    MCU AVR 32K FLASH 28-PDIP       1    0    0    
ATTINY44A-PU    IC MCU AVR 4K FLASH 20MHZ 14PDIP       1    0    0    
ATTINY85-20PU    IC AVR MCU 8K 20MHZ 8DIP       1    0    0    

And got an email shortly after that they have been shipped via DHL WW EXPRESS.

Wo! I hear thousands of clicks of people going to the website but before you go read on.

Atmel is a noble company, the low cost of their microcontrollers seems to me to indicate that their main concern is to provide us with the tools we need to make amazing things!

Look here for info about them Atmel

AVR is not supposed to stand for anything but maybe it stands for Alf-Egil (always pronounce both parts of the name, Alf_Egil pronounced Alf Eygil will probably correct you if you don't) and Vegard (actually its Vegaard where the double-a is usually an 'a'  with a little circle above it and pronounced vee-gor) these two are Norwegian dudes, and the R may stand for the Risc processor, the jury is still out smiley


Don't use uppercase in your email address when you register on
You may have to try several places to register on the site before you are in
They won't let you ask for free samples if you use a generic email address such as gmail

Let me know if you appreciate this message smiley

Happy hacking! (hacking here is mean't in the good way)

ian in Bournemouth, England (newbie member, this is my first post)

Pages: 1 2 [3]