Recent Posts

Pages: [1] 2 3 ... 10
1
Programming Questions / Re: Counting pulse in
Last post by BulldogLowell - Today at 08:52 pm
BulldogLowell thanks for the code I got it working and out putd the data to the screen and it has been a good learning curve, I've found that this just counts the pulse's which is good. I now need to figure out how to make it work, so when it receives the 2 x 250ms  short pulses turn a relay on and when it receives a single 750ms turn the relay off which means I need to work out the difference   between the 2 of them
this may work, turning on and off the onboard LED:

Code: [Select]


volatile uint32_t startMicros, endMicros;
volatile bool gotPulse;

int shortPulseCount, longPulseCount;

const byte pulsePin = 2;

void setup()
{
  Serial.begin(9600);
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(pulsePin, INPUT);  // you should have a PullDown resistor
  attachInterrupt(0, interruptTimer, CHANGE);
}

void loop()
{
  if(gotPulse)
  {
    if (endMicros - startMicros < 300000UL and endMicros - startMicros > 200000UL)  // you need to set this
    {
      shortPulseCount++;
    }
    else if (endMicros - startMicros < 700000UL and endMicros - startMicros > 600000UL)
    {
      longPulseCount++;
    }
    gotPulse = false;
  }
  if(shortPulseCount > 1)
  {
    digitalWrite(LED_BUILTIN, HIGH);
    shortPulseCount = 0;
  }
  else if (longPulseCount > 0)
  {
    digitalWrite(LED_BUILTIN, LOW);
    longPulseCount = 0;
  }
}

void interruptTimer()
{
  if(digitalRead(pulsePin))
  {
    startMicros = micros();
    return;
  }
  endMicros = micros();
  gotPulse = true;
}
2
Project Guidance / Re: My first Arduino project a...
Last post by Robin2 - Today at 08:51 pm
I would never use such a circuit  in a safety critical application .
Very wise.

...R
3
Displays / Re: TFT 320QVT 9341 Display no...
Last post by multimedia - Today at 08:51 pm
i got screen that's mirrored how do i fix? im using arduino mega and tft screen


it sais about degrees but that don't work either.
4
Oo noo do you think it is the board itself or just the ATmega328P chip
5
Robotics / Arduino autonomous car project
Last post by lukanoah - Today at 08:48 pm
Hello,

This is my autonomous car project video link for Line followinghttps://youtu.be/cXW_Md40gq0

Video for obstacles avoiding  https://youtu.be/rGz3uS5AVZY

The next step is following Line with obstacles avoiding.

6
Exhibition / Gallery / Arduino Due Chess Robot
Last post by ultraproro - Today at 08:48 pm
My chess robot has been an on-and-off hobby project which is now finally ready to show off. It has been over 7 years in the making!
Since I started on the idea (originally using a Duemilanove), I see that a quite a few similar projects have been completed. However there are a few elements to my implementation which were original design objectives which (I think) still make it worthwhile:

  • No external devices/laptops - all electronics are packaged under the board with board detection, chess engine and arm control all running off a single Arduino Due

  • Generous board size - 32cm x 32cm board for comfortable human playing (requiring arm to have 410cm reach, significantly greater than the largest Lynxmotion arm, the AL5D)

  • 'Living room ready' - finished as a low maintenance and easy to use display item, which can sit out on a coffee table (requiring single mains power connector)

Chess playing strength was not a huge focus for the project and could be improved with longer playing time or other optimisations, but is already sufficient to beat most visitors (plays about 1400 elo with only a few seconds per move).

Here's a picture of the finished robot in its new home and a video of it in action (with explanations):



Youtube link

The project divides into three main components and here's a quick overview of each:



1. Robot Arm
From the start one of my key objectives was to achieve as accurate, smooth and reliable arm movement as possible. I quickly realised that the size of my board would make this quite challenging for standard hobby servos and arm kits that were readily available.

The arm is built using basic framework components from Lynxmotion but with a customised rotating base and limb chassis to try to minimise the play in the arm from its target position. To provide the level of accuracy I needed on an arm with reach over 40cm, the elbow and shoulder servos are 7.4v digital Hitec servos. It's obviously not surgical grade but I'm pretty happy with the result.

2. Board Detection
Pieces are detected using 4mm magnets in their bases and an array of 64 reed switches under the board, read into a single pin on the Arduino by cycling through a series of 8 shift registers.
 
Reed switches are aligned perpendicular to the board, as this allowed me to drill straight into the board and position the switches as close as possible to the surface. This minimised the required strength of the magnets and eliminate the risk of adjacent squares being incorrectly triggered. I also found that this orientation was best to avoid any issues with the polarity of the magnets, ensuring that switches are closed whatever the orientation of the chess piece.
3. Chess Engine
The engine is based on the remarkable micro-Max chess by H. G. Muller (http://home.hccnet.nl/h.g.muller/max-src2.html), which is a full working chess engine smaller than 2KB in size. Although I have written a working chess engine before, that was not the main focus of the project so I wanted to use a lightweight and robust c++ engine as my starting point. I was able to get it going quite quickly on Arduino and build in the required 'hooks' to interface with the board and arm, without needing any modifications to the main engine. I did have trouble using the hash table versions on a Duemilanove due to memory restrictions, so I'm currently using version 1.6 (which uses no hash). Now that I've switched to a Due it might be possible to work with a hash table, which could allow me to use the latest versions and improve playing strength considerably.

Code and support files downloadable here.

Thank you to a number of forum contributors who helped me out along the way: LarryD; MarkT; outsider; Grumpy_Mike; Wawa; allanhurst; westfw; david_prentice; Sulimarco
7
Displays / Re: I2C LCD not displaying cha...
Last post by bencooper - Today at 08:45 pm
Please post the complete serial output for the I2CexpDiag sketch.


I haven't forgotten about you, just somehow i managed to mess up my board and I'm getting the avrdude:programmer not in sync message. Once I fix this error I'll try to run the sketch again and post the serial output.

Thanks!
8
The posted site shows a RS-232 interface cable, are you using RS-232 signals?


.
9
Project Guidance / Re: My first Arduino project a...
Last post by hammy - Today at 08:44 pm
Why not make life easy and use one digital input per connection and say a thin multi core screened cable .
Be careful too - you don't want to be riding along and the Arduino crash and the lights go out , or the engine to cut in a corner.
The electrics on a bike are very noisy, and this is a good possibility.  I would never use such a circuit  in a safety critical application .
10
Français / Re: instruction goto
Last post by 68tjs - Today at 08:43 pm
Je résume :
1) Goto est légal en C et en C++
2)Tu as parfaitement le droit de t'en servir si tu sais ce que tu fais.

Mais si ton programme est incompréhensible tu ne t'en qu'à toi même et personne ne viendra t'aider.
Pages: [1] 2 3 ... 10