I have found a bit older project of mine while browsing through my photos.. on a relatively unclean desk you can see a combination of two 28BYJ-48 motors, some screws, metal parts and a flashlight. Last of them could be replaced for example by a laserpointer, simple sensor or a distance measurement device.
Originally this was created to be placed on my amosero robot as a very simple form of an robot arm. Sadly work forced me to not follow that project side track any further which is why I can’t share more than these pictures: Maybe some when if time allows, I will recreate this and make it more accessible.
Soldering, Soldering, Soldering 🙂 Everything else had been following the amazingly well written guides of the LSM9DS0 made by sparkfun. Nine degrees of freedom at a rate of “a few per second”(currently 9Hz) since I’ve followed just the basic setup without fancy interrupt usage.
One thing thats really important to mention is the different signal voltage level of the SDA and SCL pins between the Micro(5V) and the IMU Breakout Board(3.3V) – which in case you connect them together without bi-directional level shifting, as you might expect since i2c is designed for exactly that, would lead to blue chip burn.
So wiring on the bread board (and not removing the wires used by the arduino motor shield v2, so do not get too confused by that):
and applying the library to the arduino IDE, leads to a working live example with 2 outputs per second:So the next step is to increase the rate by improving the setup wiring, parse that data into ROS Hydro by a SensorMsg/Imu publisher, kalman and combining these with other odom sources like my currently used (and sadly poor) or even an GPS source to a exact and really usable Odometry by the robot_pose_ekf package for later Simultaneous Localization and Mapping (SLAM) – a real autonomous mapping and navigation. Sounds easy right?
Today is sensor day, so I’ve managed to get the [amazon &title=DHT11&text=DHT11] working:
DHT11connected to the Arduino Micro
DHT11, only three wires are required
Wire it like that:
([amazon &title=DHT11&text=DHT11] -> Arduino Micro )
- Pin 1 (orange cable) to 5V
- Pin 2 (yellow cable) to GND
- Pin 3 – not needed
- Pin 4 (yellow again -.-) to A0
Use the following code I’ve found here:
#define dht_dpin A0 //no ; here. Set equal to channel sensor is on
delay(300);//Let system settle
Serial.println("Humidity and temperaturenn");
delay(700);//Wait rest of 1000ms recommended delay before
//This is the "heart" of the program.
Serial.print("Current humidity = ");
Serial.print("temperature = ");
delay(800);//Don't try to access too frequently... in theory
//should be once per two seconds, fastest,
//but seems to work after 0.8 second.
}// end loop()
Getting you a result like that:
It doesn’t seem to be very accurate, but that’s expectable rated by its low price (<2€)
I’ve experimented with the [amazon &title=BMP180&text=BMP180]. Since its a 3,3V breakout board which is I²C capable I had concerns since the Micro usually uses 5V on its Pins. But without a reason: the I²C on the[amazon &title=BMP180&text=BMP180] needs to get a voltage of 5V and the arduino micro also provides 3.3.
So wiring all together:
BMP180 and Arduino Micro
BMP180 and Arduino Micro
Breakout Board -> [amazon &title=Arduino Micro&text=Arduino Micro]
DA -> SDA (Digital 2)
CL -> SCL (Digital 3)
+ -> 3.3 (do NOT plug this to 5V!)
– -> GND
Sparkfun offers very good tutorials and source code. The library you’ll need to run this board can be found here
Getting this into your Arduino IDE leads to:
Since its an I²C device it should be stackable with any other I²C device in case they do not have the same BUS-address.
Using the LM35 with the Micro is quite easy.
Arduino Micro and LM35
LM35 soldered on a Board
Arduino Micro wired to the LM35
(LM35 -> [amazon &title=Arduino Micro&text=Arduino Micro] )
- 5V to positiv
- GND to –
- S to A4
And run the following code (should run on every arduino):
int tempPin = 4;
temp = analogRead(tempPin);
temp = temp * 0.48828125;
Serial.print("TEMPRATURE = ");
Getting this result:
Please note its you might need to adjust the 0.48828125 to a value thats verified with another temperature sensor (or just a normal celsius thermometer) .
The next step for me is to write a little ROS publisher for this sensor.