ラベル ESP32 の投稿を表示しています。 すべての投稿を表示
ラベル ESP32 の投稿を表示しています。 すべての投稿を表示

2022年3月19日土曜日

M5Atomでバランスロボット

 M5ATOM MATRIXとTailBATでバランスロボットを作ってみました。


 

TailBATの中には若干スペースの余裕があるので、そこにモータードライバ(共立エレショップのKP-DRV8830)を入れました。GROVE端子の基板接続部分からモータードライバへ、i2c信号と電源5VおよびGNDを配線してあります。i2cのプルアップ抵抗は追加せず、ESP32の内部プルアップのみを使っています。i2c(Wire)のクロックを50kHzに落として使っています。


モーターは、「ちっちゃいものくらぶ」の「ちびギアモータ+プーリー・タイヤセット」(https://tiisaishop.dip.jp/product/sg/)です。



モーターへの電線を通すために、やすりでTrailBatのケースを一部削りました。

 
 
 
 カバーを付けたところです。



2つのモータは、厚めの両面テープで貼り付けました。M5ATOMを取り付けた全体像の写真です。


 

裏側です。


 

M5Stack の Timer Camera X に付属のマウンターを使って、M5CAMERAに付属のスタンドを取り付けると、腕のようになります。(格好だけです)


回路図です。TailBATは省略してあります。


ビデオです。


 

TailBATについての注意。手元にあるTailBATには2種類あって、古いタイプ(写真左)は、Grove端子のソケットがATOMのピンに届きませんでした。新しいタイプ(写真右)ならば、大丈夫でした。


 

ソースコードはこちらです。

 

2021年7月28日水曜日

M5StickC Clock Auto Tuner

M5StickC (ESP32) controls the accuracy of a small pendulum clock.  The pendulum has a small magnet attached to it.  The CPU detects pendulum vibration with a Hall sensor (A3144), and determines the rate of the clock.  It then compares with the internet time, and depending on the difference, the coil under the pendulum pulls down or push up the pendulum.  This has the same effect as adjusting the gravity.


Here is the close-up of pendulum, magnet, coil and Hall sensor.

 

The accuracy chart of the clock displayed on the M5StickC.


The chart below shows accuracy and current for about 4 hours.  The blue line is clock accuracy (left scale in seconds).  Once it gets stable, the deviation is within +/- 0.2 seconds.  The red line is relative coil current.  As the clock's mainspring gets unwound, the coil current is gradually changing.



Below is the schematic diagram.  The clock has a tiny pendulum which weighs only 3.3 grams including the magnet, thus does not require much magnetic force to change cycle time.  So the coil is connected directly to the M5StickC GPIO with a series resistor of 100ohm.


Here is the video.  The clock accuracy chart and the relative coil current chart are alternating every 5 seconds.